jbanes, on Tue Jul 11, 2006 1:58 PM, said:
xucaen, on Tue Jul 11, 2006 12:32 PM, said:
Thanks guys, it sounds like based on these responses that I will need to track the X position using the divide by 15 trick.
That is not quite what I said.
Listen, if you do a RESPx to position the sprite ONCE at the beginning of the game, you will know its starting position. Throw that position into a memory location. Now, everytime you strobe HMOVE, you only need to add the value of the HMOVE Counter to the memory location. In this way, you'll always be able to track the sprite or missile's location.

DOH!
For some reason I had thought that wouldn't work. Ok, I'm with you now.
If I do
STA WSYNC
STA RESP0
Just before the game loop begins (so it only happens once) the sprite should be aligned with the left side of the screen. (when I try this it is not flush with the left edge as I had expected)
I set up my code to not do any HMOVE if my xpos is 0 or 160.
For example, lets say I HMOVE right by one clock #%11110000, then I would increment my xpos by 1. When xpos=160, then I should be at the right edge of the screen and I stop allowing any HMOVE in that direction. But for some reason it wraps back to the left side then stops. So my xpos is not at 160 when the sprite reaches the right edge of the screen. So here's what I ended up doing:
I start my xpos at #8, and moving right, I INC xpos until it reaches #152. This allows me to stop moving at what looks like the edge of the screen.
Obviously my counting is off.
Anyways, I'm attaching my source code in case anyone is interested in looking at it. It's messy, but it gets the job done. Once I get everything working the way I want it, then I'll go over it and streamline the code, but for now I'm just trying to get the basic concepts down.
player5.zip 3.17K
83 downloads
Jim