Galaxian Posted October 5, 2010 Share Posted October 5, 2010 (edited) Hello (once again) I just asked to see if anyone here knows how to make a ball in pong bounce of the walls and paddles. (Flipping its direction) I know that it sounds a bit unreasonable that I've asked for so much help, but hopefully, this will be the last time! Thank you in advance, Galaxian joy_pong.bas.bin Edited October 5, 2010 by Galaxian Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted October 5, 2010 Share Posted October 5, 2010 There's a simplistic example here: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#paddlereading Quote Link to comment Share on other sites More sharing options...
Galaxian Posted October 6, 2010 Author Share Posted October 6, 2010 There's a simplistic example here: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#paddlereading Thanks, but I'm using joysticks, not paddles. (If that is irrelevant please excuse me, I'm not very good at this) Quote Link to comment Share on other sites More sharing options...
accousticguitar Posted October 6, 2010 Share Posted October 6, 2010 You could do something like this to use a variable to store the ball direction. dim BallDir=a BallDir = 10 And then give the ball movement. MoveBall if BallDir = 10 then gosub moveupandright if BallDir = 20 then gosub movedownandright if BallDir = 30 then gosub movedownandleft if BallDir = 40 then gosub moveupandleft moveupandright ballx = ballx + 1 bally = bally + 1 return moveupandleft ballx = ballx - 1 bally = bally + 1 return movedownandright ballx = ballx + 1 bally = bally - 1 return movedownandleft ballx = ballx - 1 bally = bally - 1 return Then you would have to do collisions with the playfield and the paddle to make the ball change directions. If you look in the code for "Bong" it is commented well and might give you some ideas on that. Quote Link to comment Share on other sites More sharing options...
Galaxian Posted October 6, 2010 Author Share Posted October 6, 2010 You could do something like this to use a variable to store the ball direction. dim BallDir=a BallDir = 10 And then give the ball movement. MoveBall if BallDir = 10 then gosub moveupandright if BallDir = 20 then gosub movedownandright if BallDir = 30 then gosub movedownandleft if BallDir = 40 then gosub moveupandleft moveupandright ballx = ballx + 1 bally = bally + 1 return moveupandleft ballx = ballx - 1 bally = bally + 1 return movedownandright ballx = ballx + 1 bally = bally - 1 return movedownandleft ballx = ballx - 1 bally = bally - 1 return Then you would have to do collisions with the playfield and the paddle to make the ball change directions. If you look in the code for "Bong" it is commented well and might give you some ideas on that. Wow thanks! That should be all, but if further assistance is needed, i'll get back to you guys. THANKS!! 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.