Jump to content
IGNORED

Problems with couple of things on my first Atari game


jimbox114

Recommended Posts

So I have started my own Atari game. Right now its mainly a learning experience. My finished game I plan to have two fish who are fighting for a female fish. The first fish to get hit 10 times loses. It will then cut to a simple cutscene and show a pink fish swim to the winning player and play a little tune and thats pretty much it. The game is set up for 1 or 2 players.

 

Anyways my first major hangup is I can't get player 2 missile to fire.when joy0fire is does exaclty what I want it to do. I have looked it over and over and Im sure its something small but it just puts it right on the player and it doesn't move. Also when trying to play it in two player mode while player 1 is moving player 2 can't seem to move. Do I need some more code in there to prevent this or maybe something else? In any case here is my code I tried to add some rem statements to explain what I have done so far:

 

rem Generated 11/11/2014 3:13:05 PM by Visual bB Version 1.0.0.554
rem **********************************
rem *<Deep.bas> *
rem *<Fish Wars!> *
rem *<jimbox114@gmail.com *
rem **********************************

opening
const noscore = 1
rem p is player 1 health and q is player 2 health whichever hits 10 first loses
let p = 0:let q = 0:h = 0
playfield:
.XXXX..XXXXX...XXXXX...X...X....
.X.......X.....X.......X...X....
.XXX.....X.....XXXXX...XXXXX....
.X.......X.........X...X...X....
.X.....XXXXX...XXXXX...X...X....
................................
..X...X......X......XXXX..XXXXX.
..X...X.....X.X.....X..X..X.....
..X...X....X...X....XXXX..XXXXX.
..X.X.X...XXXXXXX...X.X.......X.
..XX.XX...X.....X...X..X..XXXXX.
end
COLUBK=$A4
COLUPF=$0E
let a = 0

drawscreen
rem tells the game to enable 2player mode
if joy0fire then goto main
if joy1fire then let a = 1:goto main:

goto opening


main

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

COLUPF=$FE
COLUBK=$80


player0x=20:player0y=50
player1x=140:player1y=50
missile0height=1:missile0x=170
missile1height=1:missile1x=0

NUSIZ0 = 16
NUSIZ1 = 16

sprites
COLUP0=$FC

player0:
%00000000
%00010000
%00001000
%01011100
%00111011
%01011100
%00001000
%00010000
end

COLUP1=$BA
player1:
%00000000
%00001000
%00010000
%00111010
%11011100
%00111010
%00010000
%00001000
end

if missile0x>155 then let missile0y=200:goto skip
if missile1x<3 then let missile1y=200:goto skip
missile0x = missile0x+2:goto draw_loop
missile1x = missile1x-2:goto draw_loop
skip
if joy0fire then missile0y=player0y-4:missile0x=player0x+4:goto playsound
if joy1fire && a = 1 then missile1y=player1y-4:missile1x=player1x+3:goto playsound

draw_loop
drawscreen

if q = 10 then goto final
if p = 10 then goto final

rem prevents players from leaving screen
if player0x < 5 then player0x = 4
if player0x > 70 then player0x = 69
if player0y < 8 then player0y = 8
if player0y > 80 then player0y = 80

if player1x > 150 && a = 1 then player1x = 150
if player1x < 80 && a = 1 then player1x = 81
if player1y < 8 && a = 1 then player1y = 8
if player1y > 80 && a = 1 then player1y = 80

if a = 1 then 1s: rem skips autocontrol and allows joy1 commands for player 2

if player0y=player1y then missile1y=player1y-4:missile1x=player1x-1:missile1x = missile1x-2
if player1x = 139 then player1y = player1y-1
if player1x = 140 then player1y = player1y+1
if player1y > 80 then player1y = player1y-8:player1x=139
if player1y < 5 then player1y = player1y+1:player1x=140
if player1y = 5 then let h = h + 1


1s
if collision(missile0,player1) then p = p +1:missile0y=255:goto playsound1
if collision(missile1,player0) then q = q +1:missile1y=255:goto playsound1

if joy0up then player0y = player0y-1:goto jump
if joy0down then player0y = player0y+1:goto jump
if joy0right then player0x = player0x+1:goto jump
if joy0left then player0x = player0x-1:goto jump

if joy1up && a = 1 then player1y = player1y-1:goto jump
if joy1down && a = 1 then player1y = player1y+1:goto jump
if joy1right && a = 1 then player1x = player1x+1:goto jump
if joy1left && a = 1 then player1x = player1x-1:goto jump


1p

if switchreset then let player1y=200:player0y=200:missile1y=200:missile0y=200:goto opening

jump
goto sprites

playsound
AUDV0 = 5 : AUDC0 = 4 : AUDF0 = 10
u = u + 2
drawscreen
if u < 1 then playsound
u = 0
AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0
goto jump

playsound1
for u = 1 to 30
AUDV0 = 5 : AUDC0 = 12 : AUDF0 = u
next u
rem p = p + 2
drawscreen
if u < 1 then playsound1
rem p = 0
AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0
goto jump

final
rem working on final cutscene need to match some colors up with the fish etc.
player0x=20:player0y=50
player1x=140:player1y=50
player1x=player1x-4
if player1x=player0x then player0y=player0y-2
if player0y<0 then COLUP0=$54:player0y=50:player0x=1
if joy0fire then goto main
if joy1fire then goto main


Link to comment
Share on other sites

You should alias the variables to make your code easier to read.

Instead of this: rem p is player 1 health and q is player 2 health whichever hits 10 first loses

Do this:

dim _Player1Health = p

dim _Player2Health = q

dim _Is2PlayerMode = a

 

Now the alias can be used in the code instead of the single letter variable name.

 

Note that the bB manual recommends a __ (2 underscores) prefix for labels and _ (single underscore) prefix for variable alias. It would be a good idea to follow this convention. See the "Using dim to Create More Descriptive Names" subtopic of http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#variables

 

I wasn't able to compile the source code you provided. Probably due to extra formatting included in your post. Maybe you can attach the .bas file instead of pasting the contents into your post.

 

Finally, there is a sub-forum for bB that would be a better place to post questions regarding bB programs.

 

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