VGAGuy Posted June 7, 2017 Share Posted June 7, 2017 I need help...again. I have a game I'm developing for the Atari 2600 and there are two things I need to get to work but can't figure out. Number one: Gravity physics. I have seen some explanations in the forums but haven't seen any code examples for it. Number 2: Changing Sprites. I can get it to change to a different sprite when a direction is pressed but can't get it to revert back to the original when no direction is pressed. Any help is appreciated. Attached is a screenshot of the game(it is in early development). Quote Link to comment Share on other sites More sharing options...
Buckaroo Posted June 7, 2017 Share Posted June 7, 2017 Number one: Gravity physics. I have seen some explanations in the forums but haven't seen any code examples for it. Here's a great example of gravity and smooth motion. It's not my original file I found it on AtariAge forum but can't remember where. inertia.bas Number 2: Changing Sprites. I can get it to change to a different sprite when a direction is pressed but can't get it to revert back to the original when no direction is pressed. Simple sprite change code Sprite change.bas Quote Link to comment Share on other sites More sharing options...
+Karl G Posted June 7, 2017 Share Posted June 7, 2017 Also, you can detect no direction being pressed with the following, and change your sprite accordingly: if SWCHA / 16 = 0 then player0: %11000011 %11100111 %01111110 %00111100 %00111100 %00011000 end Quote Link to comment Share on other sites More sharing options...
VGAGuy Posted June 7, 2017 Author Share Posted June 7, 2017 (edited) Thanks for the code, but when I ported it to my program I get this error: --- Unresolved Symbol List0.59 0000 ???? (R )FASTFETCH 0000 ???? (R ) 1761 bytes of ROM space left in bank 1 4052 bytes of ROM space left in bank 2 4052 bytes of ROM space left in bank 3 2644 bytes of ROM space left in bank 4(this is for the gravity code) Added BAS file. zargon.bas Edited June 7, 2017 by VGAGuy Quote Link to comment Share on other sites More sharing options...
+Karl G Posted June 7, 2017 Share Posted June 7, 2017 It worked for me in a test program. It's easier to help if you attach your code. My first guess would be indentation problems. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted June 7, 2017 Share Posted June 7, 2017 It worked for me in a test program. It's easier to help if you attach your code. My first guess would be indentation problems. Or not using dim so fixed point variables will work. That example program sure is full of line numbers. Quote Link to comment Share on other sites More sharing options...
VGAGuy Posted June 7, 2017 Author Share Posted June 7, 2017 (edited) I got rid of the line numbers when I pasted it in to my program. (EDIT: resolved the error, an if statement called a line number that I erased) Edited June 7, 2017 by VGAGuy Quote Link to comment Share on other sites More sharing options...
VGAGuy Posted June 7, 2017 Author Share Posted June 7, 2017 Now my problem is I am using the score as a fuel meter and want the game to end once it reaches zero but the closest I get is the game ending at 9800 on the score counter. the code I am using: if score = 0 then goto game_over Quote Link to comment Share on other sites More sharing options...
+Karl G Posted June 7, 2017 Share Posted June 7, 2017 The score is not a regular variable, and using it in a comparison operation like that does not work as expected. It is actually broken up into three different variables. Check the score section of the batari manual for details. In your case you will want: if _sc1 = $00 && _sc2 = $00 && _sc3 < $00 then ... Quote Link to comment Share on other sites More sharing options...
VGAGuy Posted June 7, 2017 Author Share Posted June 7, 2017 (edited) Everything works perfectly! Thanks a lot! I am going to have to get rid of the sprite changes because I want this to fit in 16K of ROM. EDIT: when I try to bankswitch the game just resets, I labeled the banks with spaces and the jumps without spaces, what am I doing wrong? EDIT2: Fixed, forgot to add some statements Edited June 7, 2017 by VGAGuy Quote Link to comment Share on other sites More sharing options...
VGAGuy Posted June 9, 2017 Author Share Posted June 9, 2017 (edited) (Hopefully)One last question. How would I get left and right inertia to work? And it has to fit in 75 bytes. Thanks in advance. Edited June 10, 2017 by VGAGuy 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.