Jump to content



0

Movement


2 replies to this topic

#1 Unsurreal OFFLINE  

Unsurreal

    Space Invader

  • 11 posts
  • Location:Brazil

Posted Sat May 15, 2004 5:37 PM

Hi...

I'm having difficulties on moving a sprite which was horizontally located by the RESP0 comand, it just doesn't move. Can somebody help me on this?

#2 Bad Panda Bear OFFLINE  

Bad Panda Bear

    Star Raider

  • 94 posts
  • Location:San Diego, CA

Posted Sun May 16, 2004 12:25 AM

How are you trying to move it?

If you are trying to move it by setting the HMPx registery, then it won't move until you do a "STA HMOVE". (Note this should be done after an "STA WSYNC")

If you are using a full horizontal positioning scheme like described here, then it's simply a matter of changing the horizontal position variable between frames.

Hope this helps.

#3 Unsurreal OFFLINE  

Unsurreal

    Space Invader

  • 11 posts
  • Location:Brazil

Posted Sun May 16, 2004 3:43 PM

Well, thanks anyway, but I discovered some other way to make it happen.
The problem was that at every frame I was saying to put the sprite in the same place by setting the RESP0, so it seemed that the moving routine was the problem.
I created a variable to make sure that I would locate the sprite in the place I want it to start just one time. I set it with 1 before the MainLoop (frame loop).
And then this is what I made, after the scanline loop:

; Check if I need to locate the Sprite at the center of the screen

ldy #82 ;this is the number of cycles I had to "waste"

lda rhpos ;load the variable responsable for the checking
beq hpos ;if it's 0 skip the code below and go to hpos

lda #0 ;A=0
sta rhpos ;rhpos=0, so it will never happen again

timeforhpos ;delay for right positioning
dey
bne timeforhpos

sta RESP0 ;and call the sprite right here

hpos ;label that the code goes when rhpos is 0

Thanks again.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users