stuartelectronics Posted July 28, 2021 Share Posted July 28, 2021 So I was working on my first Atari 2600 game witch is a maze game and I ran into a few problems. A major problem is I can not get the walls to work! I know that you have to do if collision(player1, playfield) then goto player1HitWall I need the same thing player 0 then later in the code i have this player0HitWall a = e b = f player0x =player0x -1 player0y =player0y +1 goto main how ever this code is not very good can some one please help me find a better code because this is just make the player fly across the screen. Also i need the ball (the item you get to give you points) to go to all the corners of the screen and then the center of the maze. and i also need there to be more than one enemy and i want them to have a certain path they take ill post the code here: rem jungle jam code START a = 75 b = 00 c = 75 d = 25 z = 0 p = 0 player0x = 75 player0y = 40 player1x = 75 player1y = 80 ballx =50 bally =40 COLUP0 = $60 COLUBK = $16 NUSIZ0 = $60 end main f=f+1 rem sprites if f = 10 then player0: %00111100 %00011000 %00011000 %01100110 %01011010 %00111100 %00011000 %00011000 end if f = 10 then player1: %01100110 %00100100 %00011000 %10111101 %01000010 %01100110 %00111100 %00011000 end playfield: XXXXXXXXXXX..XXXXX..XXXXXXXXXXX X....X.........X.........X....X X....X....X.........X....X....X XX...XX...XXXXXXXXXXX...XX...XX X.........X.........X.........X XX.XXXX...XXX.....XXX...XXXX.XX X....X.....X.......X.....X....X XX.............X.............XX X....XX..X.....X.....X..XX....X X....X...................X....X XXXXXXXXXXX..XXXXX..XXXXXXXXXXX end COLUP1 = $02 COLUP0 = $80 COLUPF = $11 if f=10 then f=0 if joy0right then REFP0 = 0 if joy0left then REFP0 = 8 drawscreen if player1y < player0y then player1y = player1y + 1 if player1y > player0y then player1y = player1y - 1 if player1x < player0x then player1x = player1x + 1 if player1x > player0x then player1x = player1x - 1 if collision(ball, player0) then goto gold if switchreset then goto START if joy0right then player0x = player0x + 1 if joy0left then player0x = player0x - 1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 if player1y < player0y then player1y = player1y + 1 if collision(player0, playfield) then goto player0HitWall if collision(player1, playfield) then goto player1HitWall if collision(player1, player0) then goto ouch if player0y < 30 then goto player0HitWall if player1y > 66 then goto player1HitWall goto main rem this is were the wall trouble is. player0HitWall a = e b = f player0x =player0x -1 player0y =player0y +1 goto main player1HitWall c = g d = h player1x =player1x -1 player1y =player1y +1 goto main rem this is were the ball trouble is gold if score = 0 then score = score + 10 bally = bally + 0 goto main if score = 20 then ballx = ballx + 30 score = score + 10 if score = 30 then bally = bally +35 else goto main if score = 30 then ballx = ballx +10 else goto main if score = 50 goto win else goto main ouch end win rem ***************************************************** rem * Music Starter using sdata rem * Based on code posted in the Ballblazer thread at AtariAge: rem * http://www.atariage.com/forums/index.php?s=&showtopic=130990&view=findpost&p=1615280 rem * Code adapted by Duane Alan Hahn (Random Terrain) rem * Code further modified by Kirk Israel rem * Explanation: rem * The 256-byte limitation is removed when using sdata. rem * You can fill a whole 4k bank with music if you want. rem ***************************************************** set smartbranching on rem ***************************************************** rem * Create aliases for variables rem ***************************************************** dim duration=a dim datareader1=x ; just a reminder dim datareader2=y ; just a reminder rem * Volume off AUDV0=0 AUDV1=0 rem * Initialize duration and set up music duration = 1 goto MusicSetup rem ***************************************************** rem * Main game loop starts here. rem ***************************************************** MainLoop goto GetMusic GotMusic drawscreen goto MainLoop rem ***************************************************** rem * Music rem ***************************************************** GetMusic rem * Check for end of current note duration = duration - 1 if duration>0 then GotMusic rem * Retrieve channel 0 data temp4 = sread(musicData) temp5 = sread(musicData) temp6 = sread(musicData) rem * Check for end of data if temp4=255 then duration = 1 : goto MusicSetup rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Set duration duration = sread(musicData) goto GotMusic rem ***************************************************** rem * Music Data Block rem ***************************************************** rem * Format: rem * v,c,f (channel 0) rem * d rem * rem * Explanation: rem * v - volume (0 to 15) rem * c - control [a.k.a. tone, voice, and distortion] (0 to 15) rem * f - frequency (0 to 31) rem * d - duration MusicSetup sdata musicData = x 0, 0, 0, 24, 8, 12, 29, 22, 0, 0, 0, 48, 8, 12, 26, 2, 255 end goto GotMusic Quote Link to comment Share on other sites More sharing options...
+KaeruYojimbo Posted July 30, 2021 Share Posted July 30, 2021 You'll have better luck getting responses if you post this in the Batari Basic subforum. I don't have time to look through it now and people who are a lot better at this stuff than I am hang out over there. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.