Thanks.
Edit:
Answered in posts below. You can use:
a=0-a
or
a = a^254
See this post for details on which one you should use:
http://www.atariage....ndpost&p=927991
Edited by Random Terrain, Thu Sep 8, 2005 11:30 PM.
Posted Thu Sep 8, 2005 4:46 AM
Edited by Random Terrain, Thu Sep 8, 2005 11:30 PM.
Posted Thu Sep 8, 2005 4:54 AM
Random Terrain, on Thu Sep 8, 2005 5:46 AM, said:
Posted Thu Sep 8, 2005 5:04 AM
batari, on Thu Sep 8, 2005 5:54 AM, said:
Random Terrain, on Thu Sep 8, 2005 5:46 AM, said:
Edited by Random Terrain, Thu Sep 8, 2005 5:07 AM.
Posted Thu Sep 8, 2005 8:39 AM
rem * Here's a crappy little program I (Random Terrain) made as an example of rem * sprite movement with the joystick. You control a sprite and there is also rem * a bouncing ball that you can bang into. rem * Don't worry, you are blocked from going past the edge of the screen. gamestart rem * Create alias for each variable. dim spritex = a dim spritey = b dim directionx = c dim directiony = d dim directionx2 = e dim directiony2 = f rem * Setup. COLUPF = 204 : score = 0 player0x = 93 : player0y = 54 bally = 30 : ballheight = 1 r = rand : if r > 30 && r < 155 then ballx = r else ballx = 30 directionx = 1 : directiony = 1 directionx2 = 255 : directiony2 = 255 rem * Define player0 shape. player0: %11111111 %10100101 %10100101 %10111101 %10111101 %10100101 %10100101 %11111111 end rem * Main game loop starts here. gameloop scorecolor = 158 COLUP0 = 28 drawscreen rem * Move player0 if joystick is used and don't allow border crossing. if joy0up && player0y > 10 then player0y = player0y - 1 if joy0down && player0y < 89 then player0y = player0y + 1 if joy0left && player0x > 15 then player0x = player0x - 1 if joy0right && player0x < 167 then player0x = player0x + 1 rem * Move ball and don't allow border crossing and detect collision with player0. if bally < 3 then directiony = 1 : directiony2 = 255 if bally > 87 then directiony = 255 : directiony2 = 1 if ballx < 16 then directionx = 1 : directionx2 = 255 if ballx > 174 then directionx = 255 : directionx2 = 1 if collision(ball,player0) then directionx = directionx2 : directiony = directiony2 : score = score + 10 ballx = ballx + directionx : bally = bally + directiony if switchreset then goto gamestart goto gameloopAs you can see, I just made an opposite within the if-then statements that already existed. Might be a better way than that, but I can't think of it.
rem * Here's a crappy little program I (Random Terrain) made as an example of rem * sprite movement with the joystick. You control a sprite and there is also rem * a bouncing ball that you can bang into. rem * Don't worry, you are blocked from going past the edge of the screen. gamestart rem * Create alias for each variable. dim spritex = a dim spritey = b dim directionx = c dim directiony = d rem * Setup. COLUPF = 204 : score = 0 player0x = 93 : player0y = 54 bally = 30 : ballheight = 1 r = rand : if r > 30 && r < 155 then ballx = r else ballx = 30 directionx = 1 : directiony = 1 rem * Define player0 shape. player0: %11111111 %10100101 %10100101 %10111101 %10111101 %10100101 %10100101 %11111111 end rem * Main game loop starts here. gameloop scorecolor = 158 COLUP0 = 28 drawscreen rem * Move player0 if joystick is used and don't allow border crossing. if joy0up && player0y > 10 then player0y = player0y - 1 if joy0down && player0y < 89 then player0y = player0y + 1 if joy0left && player0x > 15 then player0x = player0x - 1 if joy0right && player0x < 167 then player0x = player0x + 1 rem * Move ball and don't allow border crossing and detect colision with player0. if bally < 3 then directiony = 1 if bally > 87 then directiony = 255 if ballx < 16 then directionx = 1 if ballx > 174 then directionx = 255 if collision(player0,ball) then directionx = directionx^254 : directiony = directiony^254 : score = score + 10 ballx = ballx + directionx : bally = bally + directiony if switchreset then goto gamestart goto gameloop
Edited by Random Terrain, Thu Sep 8, 2005 11:41 PM.
Posted Thu Sep 8, 2005 3:40 PM
Posted Thu Sep 8, 2005 4:44 PM
Edited by Zach, Thu Sep 8, 2005 4:52 PM.
Posted Thu Sep 8, 2005 7:25 PM
batari, on Thu Sep 8, 2005 4:45 PM, said:
Zach, on Thu Sep 8, 2005 5:44 PM, said:
Posted Thu Sep 8, 2005 11:15 PM
Random Terrain, on Thu Sep 8, 2005 9:25 PM, said:
batari, on Thu Sep 8, 2005 4:45 PM, said:
Zach, on Thu Sep 8, 2005 5:44 PM, said:
Posted Thu Sep 8, 2005 11:37 PM
SeaGtGruff, on Fri Sep 9, 2005 12:15 AM, said:
Posted Fri Sep 9, 2005 6:14 AM
Posted Fri Sep 9, 2005 6:31 AM
Chad Hendrickson, on Fri Sep 9, 2005 7:14 AM, said:
Posted Fri Sep 9, 2005 6:38 AM
Chad Hendrickson, on Fri Sep 9, 2005 8:14 AM, said:
Posted Fri Sep 9, 2005 6:45 AM
SeaGtGruff, on Fri Sep 9, 2005 7:38 AM, said:
Chad Hendrickson, on Fri Sep 9, 2005 8:14 AM, said:
Posted Fri Sep 9, 2005 2:25 PM
SeaGtGruff, on Fri Sep 9, 2005 7:38 AM, said:
Chad Hendrickson, on Fri Sep 9, 2005 8:14 AM, said:
0 members, 0 guests, 0 anonymous users