Jump to content
IGNORED

Getting missile to work?


endrien

Recommended Posts

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
Link to comment
Share on other sites

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 icon_smile.gif

 

In particular check out 4_FireAMissile.bas example here:

http://www.atariage....r-bb-beginners/

Link to comment
Share on other sites

Try looking at my first bB attempt Drunken Pooper (original concept and game by Matt Ripston)

http://www.atariage.com/forums/topic/165286-conversion-of-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.com/forums/topic/109288-code-snippets-samples-for-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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.com/atari-2600-memories-batari-basic-commands.html#kernelopchart

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...