Jump to content

Photo

Need Help With A Game


10 replies to this topic

#1 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • 29 posts
  • Avid Bankswitcher

Posted Wed Jun 7, 2017 2:31 AM

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).

 

zargon.bas.bin.png



#2 Buckaroo OFFLINE  

Buckaroo

    Space Invader

  • 19 posts
  • Location:Plymouth, UK

Posted Wed Jun 7, 2017 7:09 AM

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.
 
Attached File  inertia.bas   1019bytes   10 downloads
 
 

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

Attached File  Sprite change.bas   332bytes   9 downloads

 



#3 kdgarris ONLINE  

kdgarris

    Chopper Commander

  • 159 posts

Posted Wed Jun 7, 2017 8:04 AM

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


#4 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • Topic Starter
  • 29 posts
  • Avid Bankswitcher

Posted Wed Jun 7, 2017 9:02 AM

Thanks for the code, but when I ported it to my program I get this error:

--- Unresolved Symbol List
0.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.

Attached Files


Edited by VGAGuy, Wed Jun 7, 2017 9:19 AM.


#5 kdgarris ONLINE  

kdgarris

    Chopper Commander

  • 159 posts

Posted Wed Jun 7, 2017 9:12 AM

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.

#6 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,069 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Jun 7, 2017 9:25 AM

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.



#7 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • Topic Starter
  • 29 posts
  • Avid Bankswitcher

Posted Wed Jun 7, 2017 9:30 AM

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 by VGAGuy, Wed Jun 7, 2017 11:23 AM.


#8 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • Topic Starter
  • 29 posts
  • Avid Bankswitcher

Posted Wed Jun 7, 2017 11:54 AM

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



#9 kdgarris ONLINE  

kdgarris

    Chopper Commander

  • 159 posts

Posted Wed Jun 7, 2017 12:14 PM

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 ...


#10 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • Topic Starter
  • 29 posts
  • Avid Bankswitcher

Posted Wed Jun 7, 2017 1:26 PM

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 by VGAGuy, Wed Jun 7, 2017 5:26 PM.


#11 VGAGuy OFFLINE  

VGAGuy

    Space Invader

  • Topic Starter
  • 29 posts
  • Avid Bankswitcher

Posted Thu Jun 8, 2017 10:26 PM

(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 by VGAGuy, Fri Jun 9, 2017 6:42 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users