RHillFake Posted June 20, 2014 Share Posted June 20, 2014 I am having trouble making my game. You are supposed to avoid the playfield and land on the blue block in my game but the second level player does not move. I made some example code. set tv ntsc set romsize 4k set kernel_options no_blank_lines intro pfclear playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..XXXXX..XXXX...XXX..XXXXX....X X....X....X.....X.......X......X X....X....XXX....XXX....X......X X....X....X.........X...X......X X....X....XXXXX.XXXX....X..X...X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end title COLUBK = $C2 COLUPF = $F0 player0x=125:player0y=50 player1x=35:player1y=50 drawscreen if joy0fire || joy1fire then goto skiptitle goto title skiptitle playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end COLUBK = $AE COLUPF = $08 m = 0 main if collision(player1,player0) then COLUBK=$0E if collision(player0,player1) then goto level2 COLUP1 = $80 COLUP0 = $40 COLUPF = $08 if f=00 then f=0 if g=00 then g=0 player0: %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 end player1: %11111111 %11111111 %11111111 %11111111 %00000000 %00000000 %00000000 %00000000 end checkfire skip draw drawscreen if m = 1 && collision(player0,playfield) then player0y = player0y + 1 : goto intro if m = 2 && collision(player0,playfield) then player0x = player0x + 1 : goto intro if m = 3 && collision(player0,playfield) then player0y = player0y - 1 : goto intro if m = 4 && collision(player0,playfield) then player0x = player0x - 1: goto intro if joy0up && !collision(player0,playfield) then player0y = player0y - 1 : m = 1 : goto skipmove if joy0left && !collision(player0,playfield) then player0x = player0x - 1 : REFP0 = 8 : m = 2 : goto skipmove if joy0down && !collision(player0,playfield) then player0y = player0y + 1 : m = 3 : goto skipmove if joy0right && !collision(player0,playfield) then player0x = player0x + 1 : m = 4 : REFP0 = 0 : goto skipmove skipmove goto main level2 drawscreen2 pfclear playfield: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end COLUBK = $5A main2 COLUP1 = $AE COLUP0 = $1C COLUPF = $08 player0: %10011001 %10011001 %10011001 %11111111 %11111111 %00011000 %00011000 %00011000 end player0x=35:player0y=50 player1x=125:player1y=50 if f=00 then f=0 if g=00 then g=0 checkfire2 skip2 draw2 drawscreen if m = 1 && collision(player0,playfield) then player0y = player0y + 1 : goto level2 if m = 2 && collision(player0,playfield) then player0x = player0x + 1 : goto level2 if m = 3 && collision(player0,playfield) then player0y = player0y - 1 : goto level2 if m = 4 && collision(player0,playfield) then player0x = player0x - 1: goto level2 if joy0up && !collision(player0,playfield) then player0y = player0y - 1 : m = 1 : goto main2 if joy0left && !collision(player0,playfield) then player0x = player0x - 1 : REFP0 = 8 : m = 2 : goto main2 if joy0down && !collision(player0,playfield) then player0y = player0y + 1 : m = 3 : goto main2 if joy0right && !collision(player0,playfield) then player0x = player0x + 1 : m = 4 : REFP0 = 0 : goto main2 skipmove2 goto main2 Quote Link to comment Share on other sites More sharing options...
bogax Posted June 20, 2014 Share Posted June 20, 2014 (edited) You are initializing your player positionsinside the main2 loop. Edited June 20, 2014 by bogax Quote Link to comment Share on other sites More sharing options...
RHillFake Posted June 21, 2014 Author Share Posted June 21, 2014 You are initializing your player positions inside the main2 loop. Thanks a ton! I spent a whole week trying to figure out what was wrong before I asked and it was so simple. 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.