Jump to content
  • entries
    4,945
  • comments
    2,718
  • views
    1,808,464

Go, Sub!


atari2600land

1,601 views

Well, I finally got the collision detection and title screen working, but I still need to figure out (or rather, someone needs to figure out for me, because I'm apparently too dumb to make the code right :( ) how to make the sub move when the joystick isn't pressed. I've tried lots of different things but nothing seems to work. And if you're one of the few people who ordered Fatso, here's a picture of what you'll be getting. I can't wait for it to come in the mail, I'll have to wait longer because I'm in the United States and the game is coming from Belgium. So anyway, his schedule says "May 9- prepare shipping." And yesterday I got the first season of SNL from 1975-76 for only $30, original retail price was over $60. 8 CDs worth of stuff.

4 Comments


Recommended Comments

To make something keep moving in the last direction you need to use "movement deltas". Lets say you have the following variables :-

 

shipX - the ship sprite's X position on screen

shipY - the ship sprite's Y position on screen

deltaX - the ship sprite's movement direction in X

deltaY - the ship sprite's movement direction in Y

 

Initialise deltaX and deltaY to zero outside the main game loop

If you detect left on the stick then make deltaX equal to -1

If you detect right on the stick then make deltaX equal to +1

If you detect up on the stick then make deltaY equal to -1

If you detect down on the stick then make deltaY equal to +1

If you detect no stick activity then don't change deltaX or deltaY

 

You might have to swap up for down above because I'm not sure if the G7000 starts Y at zero from the top or the bottom of the screen.

 

After that just do (in pseudo code) :-

 

shipX=shipX+deltaX

shipY=shipY+deltaY

 

Then the ship sprite will always move in the last direction the stick was in including the diagonals.

Link to comment

Why does everyone use psuedo code on me? I'm still new to assembly so I need actual code to get anywhere to learning things.

Link to comment

Why does everyone use psuedo code on me? I'm still new to assembly so I need actual code to get anywhere to learning things.

 

Conversion from pseudo code (or batari basic for that matter) to your machine of choice is a handy skill to have. Once you have things like "if/then/else" down in assembly language you are well on the way to doing interesting things.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...