Jump to content
abaudrand

Programming missile trouble

Recommended Posts

Hi,

I'm still developping the missile and I got something messy (again...). I've wrote a generic missile equation who will depend of 2 variables for determining the direction of the arrow.

The compilation failed... I've read on the batari command list that negative variable are ok so... I don't have a clue what's wrong...

 

Basically, I wanted to do something that will store your last know position to determine which direction to fire (like in the Atarius Maximus script). But contrary to this script, I wanted to let the arrow go out playfield before you can shoot again.

so I assigned the "b" to check if arrow is shoot or not. If not fired (b=0) then u can shoot in any direction (determined by c(X)) who will give you a "d" and "e" number for moving the missile0x and missileOy.

Once the missile reach out the playfield, all value are reset to 0 so that you can shoot again.

 

 

The DragonV6 version worked as it doesn't include the firing equation.

Share this post


Link to post
Share on other sites

I'm taking a look at your code now. The first thing I notice is score=0, a=0, b=0, c=0, d=0. Those are in your title screen loop. You can place them outside your loop. Just one less thing for your code to go over and over.

 

I compiled and am playing dragonv7 as we speak. Not sure what you mean compilation failed.

Edited by yuppicide

Share this post


Link to post
Share on other sites

I'm adding this to the bB page right now:

 

http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#negative

It looks like 4.4 fixed point types were coded properly, but apparently integers were not, so a = -1 will not work with plain old normal numbers. If you need to flip a variable between a positive number and a negative number, a=0-a will work. Of course, a can be any variable.
Edited by Random Terrain

Share this post


Link to post
Share on other sites

When I'm doing the basic compilation, the process stops at L044. which is the line with one negative value for d.

 

Compiling C:\Documents and Settings\Al\Desktop\Ghost\DRAGONV7.bas
2600 Basic compilation failed!
LINE -->Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Al\Desktop\Ghost>preprocess <DRAGONV7.bas >47332440-695e-42cd-b15a-4e5d226c4d7c.tmp

C:\DOCUME~1\Al\Desktop\Ghost>2600basic -i <47332440-695e-42cd-b15a-4e5d226c4d7c.tmp %bB%
game
.L00 ;  rem ' Dragonblast

.L01 ;  rem ' v.7

.L02 ;  rem ' Author: Alexandre BAUDRAND 

 

(...)

 

.L044 ;  if joy0fire  &&  c{5} then missile0x = player0x : missile0y = player0y - 7 : b = 1 : d =  - 1 : e =  - 1

lda #$80
bit INPT4
BNE .skipL044
.condpart9
LDA c
AND #32
BEQ .skip9then
.condpart10
LDA player0x
STA missile0x
LDA player0y
SEC
SBC #7
STA missile0y
LDA #1
STA b
LDA #255

C:\DOCUME~1\Al\Desktop\Ghost>@exit

 

So that's all... I can't make it work for the moment. maybe I'll rewrite my missile behaviour to get rid of the negative value...

Share this post


Link to post
Share on other sites

I'm not that familiar with bB, but I believe those variables are stored as bytes. If so, you can use 255 instead of -1. That continues with 254 = -2, 253 = -3, etc.

 

EDIT: The other thing that might be the problem is there's a space between the - and the 1. Try using just -1 instead of - 1.

Edited by SpiceWare

Share this post


Link to post
Share on other sites

Ok, I'm a bit slow in understanding. I did as Random Terrain said: just put d=d-1 instead of d=-1. It works and now I can shoot in all directions !!! :_D

 

I will try now the make the arrow look like an arrow... :)

Thanks again Random terrain !!!

Share this post


Link to post
Share on other sites

Ok, I'm a bit slow in understanding. I did as Random Terrain said: just put d=d-1 instead of d=-1. It works and now I can shoot in all directions !!! :_D

 

I will try now the make the arrow look like an arrow... :)

Thanks again Random terrain !!!

It would be d=0-d.

Share this post


Link to post
Share on other sites

Have you tried the d = 255 I mentioned in post #5? It would run quicker and use less ROM space than d = 0-d.

Share this post


Link to post
Share on other sites
If so, you can use 255 instead of -1. That continues with 254 = -2, 253 = -3, etc.

Have you tried the d = 255 I mentioned in post #5? It would run quicker and use less ROM space than d = 0-d.

Yeah, d=0-d is only for flipping negative/positive. d=-d didn't used to work, but it seems to work now.

 

Like you said, if we want to use a specific negative number, we'd just subtract the number from 256. So if we want to use a = -12, we would use a calculator and do 256 - 12 and that's 244, so we'd use a = 244.

Edited by Random Terrain

Share this post


Link to post
Share on other sites

Have you tried the d = 255 I mentioned in post #5? It would run quicker and use less ROM space than d = 0-d.

 

I've just tried to replace it by 255. It works except for shooting in the downleft direction as the missile make a bounce on the rampart and go back upward ! For the moment, I left it as it is...

Thanks for the explanations anyway. I will keep your advice in mind for the rest of the game as I plan other variables...

Share this post


Link to post
Share on other sites
If so, you can use 255 instead of -1. That continues with 254 = -2, 253 = -3, etc.

Have you tried the d = 255 I mentioned in post #5? It would run quicker and use less ROM space than d = 0-d.

Yeah, d=0-d is only for flipping negative/positive. d=-d didn't used to work, but it seems to work now.

 

Like you said, if we want to use a specific negative number, we'd just subtract the number from 256. So if we want to use a = -12, we would use a calculator and do 256 - 12 and that's 244, so we'd use a = 244.

 

 

My apologies, your tip works perfect, I've wrote a minus where it should not so the arrow go in wrong direction...

and yes it saves a lot : 23 bytes.

Share this post


Link to post
Share on other sites

glad you found the problem :)

 

Your welcome, It's the first time I met so many people glad to help a profane to get on his first game.

I've just fixed the shape of the arrow to make it longer and changing depending which axe you are firing from. I will post the .bas file later today so that my bro can play it too.

Next week, I'll try to make 3 different behaviour for the ennemy : Flying around with a sine curve - Firing at player0 if player1 is just above him - storming at player0 (current behaviour, but I wish I could make the dragon grab the player0 out of the screen)

 

I've run the zombie game which is included as example but the trajectory of the zombie is for the moment beyond my skills... I need to go back on reading the commands manual before going further.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...