Jump to content
IGNORED

Problems with my first Atari game


jimbox114

Recommended Posts

I have been working on a simple Atari game. The basics is two fish blowing bubbles (missiles) at each other. The first fish to get hit 10 times loses and it will go to a cutscene showing the winning fish swim up to a female (pink) fish and play a little tune and be over.

 

I have it set up to be 1 player or 2 player. If joy1fire is pressed at the title screen it sets a variable to skip the auto controls for the other player and allow joystick controls.

 

I am having two problems with it right now. For starters I can't get player1 to shoot a missile. Rather its on 1player or 2player it just sets the missile in front of the player and it doens't move.

 

The other problem is while playing in 2 player. If player0 is moving player1's controls don't work until the move ends.

 

Here is the code, I have also included the .bas files in case the spacing is off on this copy and paste:

 

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

 

deep.bas

Link to comment
Share on other sites

The problem you're having is that you've tangled the different if statements together. This is causing the right player to have dependencies on the left player's state.

 

Change:

 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

To:

rem if else structure for missle0 processing
 if missile0x < 154 then  missile0x = missile0x+2 : goto skip0
 missile0y=200
 if joy0fire then missile0y=player0y-4:missile0x=player0x+4:goto playsound
skip0


rem if else structure for missle1 processing
 if missile1x > 2 then  missile1x = missile1x-2 : goto skip1
 missile1y=200
 if joy1fire && a = 1 then missile1y=player1y-4:missile1x=player1x+3:goto playsound
skip1

Make sure you understand this if/else pattern before you proceed. There are other places where you have the same issue. This is why the fish will not change both x and y position at the same time.

Link to comment
Share on other sites

Thanks for the reply. I looked at my player controls and removed the :goto statements at the end of each of my joy commands that that solved player 1 overriding player 2. Your missle code also took care of it as well. I really apprecaite the help I can honestly say I learned something today. When I went back and read the code I could see exactly the problem.

 

Now both fish blow bubbles with sound and they both can move all directions as well.

 

Now all I need is a healthbar for each of them and my cutscene but I think I can handle that with some research.

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