Jump to content

Adjusting player movement speed

Recommended Posts

Been learning the basics of 2600 coding and I want to focus on getting a good handle on player movement, particularly the speed the player moves.


I have a sample project where I move a player left and right on the screen by updating their x position on each frame. I also use the standard `DIVIDE_LOOP` logic to handle the fine position.


What I'd like to look into now is changing how fast the player moves. Double incrementing/decrementing the x position per update is easy and doubles the speed, and I just played around with implementing an update counter that waits # of frames before applying a change to the x position. That works okay at every other frame, but once you get to updating only every 4 frames the movement gets choppy. Makes sense because the player is not moving at all, then is, then isn't for another four.


This doesn't feel like the right path to take if I want a character to smoothly walk slower. So I'm wondering the focus should be on adapting the fine position and changing that per frame.


Long winded story, but my questions are:


Is slow and smooth movement achieved by writing different `DIVIDE_LOOP` and adjusting the fine movement?


If so, is there any info or examples around that can aid me with this?


EDIT: I just had a look a the DIVIDE_LOOP and I think my understanding was incorrect there and changing that isn't going to provide any finer positioning beyond the provided x position. Though the 2600 continues to confuse and amuse so I don't want to feel like I have a handle on the code enough yet to say I really get it.

Edited by Dagger
Further infomation.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   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.

  • Recently Browsing   0 members

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