johnon, on Tue Apr 6, 2010 5:54 PM, said:
Is there any way at all to calculate the initial position of the player after drawing it and then storing it to a register, unlike in Kirk Israel's tutorial where he sets the current Y position before drawing the player?
EDIT: I also wanted to do this for Horizontal position, as well
You need to set the desired (X,Y) position first, then draw the player at that position. When the player moves, you change the known (X,Y) position accordingly, draw the player at the new position, and repeat (update the position, draw the player there, update the position, draw the player there, etc.).
The idea of first drawing the player "somewhere" on the screen, then trying to figure out what position you just drew the player at, is backwards.
As for keeping the player from going past some point on the screen without using collision detection, that's just a matter of comparing the new position against the position you don't want to go past. With regard to displaying the score at the bottom of the screen, and wanting to keep the player from wandering into that area, it couldn't happen if you're using the two players to draw the score, because your kernel's drawing routine would have to change at that point to draw the score, and it won't even try to draw one of the players as a ship, enemy, or whatever while the code is specifically drawing the score.
But if you draw the score using the playfield (as in Space Invaders, for example), then you might be able to move the player into the score display region if your code is designed to allow that.
Michael