I want to have a "jumping" sprite, and I'm confused on the best way to do it. For other languages/machines I've always done gravity kind of like this:
YVelocity = 10 ; Set initial jumping velocity UpdatePlayerPos: ; Called every frame PlayerY = PlayerY - YVelocity YVelocity = YVelocity - 1
So that for the first frame after jumping the player moves up 10 pixels, then 9,8,7,6,5,4,3,2,1,0 then -1,-2,-3,-4,-5,-6....
Giving a nice looking effect of gravity as a player jumps, then lands.
Implementing this for the 2600 is harder then I imagined - I can't move a player 10 pixels a frame, that'd look crazy. The way I imagine would look correct would be that I move the player up one pixel after 1 frame, then up one pixel again after 2 frames, then 3,4,5,6,7,8,9,10 then 9,8,7,6,5,4,3,2,1 frames (maybe not 10 frames... that'd be quite a pause mid air)
I've been trying to implement something like this, but it's looking verrry messy (codewise), and not very impressive. Its easy when everything on screen moves 1 pixel per frame, but I can't figure out how timing can be done nicely.
Are there any "standard" ways to do timing for games? How would you do it if some sprites need to move quickly (say, 3 pixels per frame) and others need to move slowly (say, 1 pixel every 3 frames)? How do you handle these timing issues?!















