Jump to content

Photo

Getting missile to work?


13 replies to this topic

#1 endrien OFFLINE  

endrien

    Chopper Commander

  • 183 posts

Posted Fri Aug 20, 2010 9:47 PM

The code snippets kind of contradict each other, the "move a sprite" says put x=50 y=50, player0y=y player0x=x. Then in the missile snippet it says to put player0y=p0y and player0x=p0x. What happened?

My code currently does not launch a missile, it launches the player and changes the sprite color.
Can anyone help?

 set kernel_options playercolors player1colors pfcolors
 set kernel_options pfcolors

 e=0   : rem  counter for firing gun
 c=50  : rem  player0 x position
 d=50  : rem  player0 y position

 dim fire=e
 dim p0y=d
 dim p0x=c
 
 x=50
 y=50

main
  
 COLUBK=02

 player0y=y
 player0x=x

 pfcolors:
 $00
 $00
 $00
 $00
 $00
 $00
 $00
 $00
 $00
 $00
 $00
end

 playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X...............................
 X...............................
 X...............................
 X...............................
 X...............................
 X...............................
 X...............................
 X...............................
 X...............................
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end


 player0color:
 $00
 $40
 $40
 $40
 $40
 $40
 $40
 $20
 $00
 $00
end


 player0:
 %00111000
 %00110000
 %00110000
 %01111000
 %01111000
 %01111000
 %00110000
 %00111000
 %01111100
 %00111000
end

 if x>140 || missile0x>140 then missile0y=11
 if !joy0fire then fire=0 : x=p0x : missile0x=0 : missile0y=0
 if joy0fire then missile0x=x+8:missile0y=p0y-y-6
 if fire<60 && missile0x>135 then missile0y=0
 if fire<60 then x=x+2 else missile0y=0
 if fire>250 then fire=25

 fire=fire+1
 


 rem write data to the screen
 drawscreen

 rem joystick movements
 
 if joy0right then x=x+1
 if joy0left then x=x-1
 if joy0up then y=y-1
 if joy0down then y=y+1

 rem loops game
 goto main

Edited by endrien, Fri Aug 20, 2010 9:48 PM.


#2 theloon ONLINE  

theloon

    Quadrunner

  • 7,819 posts

Posted Fri Aug 20, 2010 10:15 PM

Try looking at my first bB attempt Drunken Pooper
http://www.atariage....drunken-pooper/

Notice how I use a variable called shooting to determine how I should deal with moving the missle.

There are better examples out there so don't hate me too badly for this weak answer Posted Image

In particular check out 4_FireAMissile.bas example here:
http://www.atariage....r-bb-beginners/

#3 endrien OFFLINE  

endrien

    Chopper Commander

  • Topic Starter
  • 183 posts

Posted Fri Aug 20, 2010 10:22 PM

Try looking at my first bB attempt Drunken Pooper (original concept and game by Matt Ripston)
http://www.atariage....drunken-pooper/

Notice how I use a variable called shooting to determine how I should deal with moving the missle.

There are better examples out there so don't hate me too badly for this weak answer :)

In particular check out 4_FireAMissile.bas example here:
http://www.atariage....r-bb-beginners/


That last link is what I'm referring to as snippets which Is where I got the fire missile code.

Edited by endrien, Fri Aug 20, 2010 10:23 PM.


#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 24,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Aug 20, 2010 10:57 PM

That last link is what I'm referring to as snippets which Is where I got the fire missile code.

I just looked at the 4_FireAMissile.bas program and it uses COLUP1=$28 instead of COLUP0=$28, so it doesn't even work as-is. The code looks a little odd too, so I would be careful about using those programs as gospel. I'm going to be adding some example programs to the bB page as soon as possible and they will be tested to make sure they work.

Do you want a missile to shoot like in most games where it continues until it hits something or the edge of the screen, or do you want it to work like that example program (using COLUP0=$28) where it restarts before the shot is over if you press the fire button?

#5 endrien OFFLINE  

endrien

    Chopper Commander

  • Topic Starter
  • 183 posts

Posted Sat Aug 21, 2010 10:31 AM

That last link is what I'm referring to as snippets which Is where I got the fire missile code.

I just looked at the 4_FireAMissile.bas program and it uses COLUP1=$28 instead of COLUP0=$28, so it doesn't even work as-is. The code looks a little odd too, so I would be careful about using those programs as gospel. I'm going to be adding some example programs to the bB page as soon as possible and they will be tested to make sure they work.

Do you want a missile to shoot like in most games where it continues until it hits something or the edge of the screen, or do you want it to work like that example program (using COLUP0=$28) where it restarts before the shot is over if you press the fire button?


I want the missile to shoot like most games, that code I noticed you have to hold fire. My plan was to have my character kick and it would shoot from his foot.
I don't really have anything else to go off of for learning things like this as far as I'm aware. There's not really any other source as your site just explains vbB(and does a good job of it too)

#6 pitfall_jerry OFFLINE  

pitfall_jerry

    Space Invader

  • 37 posts
  • Location:Atlanta, GA

Posted Mon Aug 23, 2010 10:12 AM

I have tried using the code also for moving missiles and now I know it wasn't just me being a noob.

That last link is what I'm referring to as snippets which Is where I got the fire missile code.

I just looked at the 4_FireAMissile.bas program and it uses COLUP1=$28 instead of COLUP0=$28, so it doesn't even work as-is. The code looks a little odd too, so I would be careful about using those programs as gospel. I'm going to be adding some example programs to the bB page as soon as possible and they will be tested to make sure they work.

Do you want a missile to shoot like in most games where it continues until it hits something or the edge of the screen, or do you want it to work like that example program (using COLUP0=$28) where it restarts before the shot is over if you press the fire button?



#7 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 24,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Mon Aug 23, 2010 4:09 PM

I have tried using the code also for moving missiles and now I know it wasn't just me being a noob.

Yeah, I'm working on a missile example program for the bB page right now. It's taking me a day or two longer than I hoped. I'll be adding more example programs over time too using hints, tips, and code snippets from AtariAge members such as batari, SeaGtGruff, RevEng, Robert M, Atarius Maximus, and jrok.

#8 endrien OFFLINE  

endrien

    Chopper Commander

  • Topic Starter
  • 183 posts

Posted Mon Aug 23, 2010 8:17 PM

I have tried using the code also for moving missiles and now I know it wasn't just me being a noob.

Yeah, I'm working on a missile example program for the bB page right now. It's taking me a day or two longer than I hoped. I'll be adding more example programs over time too using hints, tips, and code snippets from AtariAge members such as batari, SeaGtGruff, RevEng, Robert M, Atarius Maximus, and jrok.

As long as its useful information, I don't care how long it takes you to get the example code done. I want my first game to be a finished production worthy game, not make a bunch of meh games. My intention was to code basic things first then build upon levels and change code if needed as I learn. Ultimately a fun experience :).


I've got a question though, Whats the amount of frames an animation should have? I figure 3 sounds about right.

#9 TooSlowGamer OFFLINE  

TooSlowGamer

    Chopper Commander

  • 126 posts

Posted Mon Aug 23, 2010 8:30 PM

Has this problem been resolved?

If not, I know the problem. It's the first line in the code:

set kernel_options playercolors player1colors pfcolors

playercolors and player1colors come at a cost. That cost is a loss of missile 0 and 1.

For more information, check out the "kernel_options chart" here:

http://randomterrain...l#kernelopchart

#10 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 24,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Mon Aug 23, 2010 8:33 PM

I've got a question though, Whats the amount of frames an animation should have? I figure 3 sounds about right.

My first missile example program just uses an overhead view of a ship thingy and it has 4 frames for each direction. If you have a guy walking around, you might be able to get away with 3 frames. All depends on what kind of look you are going for.

#11 endrien OFFLINE  

endrien

    Chopper Commander

  • Topic Starter
  • 183 posts

Posted Mon Aug 23, 2010 9:06 PM

I've got a question though, Whats the amount of frames an animation should have? I figure 3 sounds about right.

My first missile example program just uses an overhead view of a ship thingy and it has 4 frames for each direction. If you have a guy walking around, you might be able to get away with 3 frames. All depends on what kind of look you are going for.

My animation of a guy kicking his leg has 3 frames, seems overkill to have any more for that.

#12 endrien OFFLINE  

endrien

    Chopper Commander

  • Topic Starter
  • 183 posts

Posted Wed Aug 25, 2010 9:26 PM

Any update on this yet?

#13 TooSlowGamer OFFLINE  

TooSlowGamer

    Chopper Commander

  • 126 posts

Posted Wed Aug 25, 2010 9:37 PM

Any update on this yet?


I may be able to help, but I can't seem to find what your current, unresolved question actually is.

#14 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 24,910 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Aug 25, 2010 9:42 PM

Any update on this yet?

If you mean the first example program, it seems to be almost done. It's taking forever to add the detailed comments.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users