nesdev.com
http://forums.nesdev.com/

Help with horizontal sprite flip
http://forums.nesdev.com/viewtopic.php?f=2&t=16982
Page 2 of 2

Author:  dougeff [ Sat Jan 27, 2018 7:48 pm ]
Post subject:  Re: Help with horizontal sprite flip

Another thing...

Quote:
UpdatePlayer:
LDA buttons1
AND #%10000000
BEQ PlayerAPressed
etc...


Consider what would happen if you want to press Down and B on the same frame.

And

Consider a situation where you want to trigger something upon first press of a button, but not If it's held down.

Example. I had a series of screens at the beginning of my game, where 'Start' would go from one screen to the next. With your setup, it would zip through all of the screens in a few frames if you held down the Start button.

Thus, I also needed to remember the buttons from the previous frame as well.

Author:  instantaphex [ Sat Jan 27, 2018 8:18 pm ]
Post subject:  Re: Help with horizontal sprite flip

dougeff wrote:
Another thing...

Quote:
UpdatePlayer:
LDA buttons1
AND #%10000000
BEQ PlayerAPressed
etc...


Consider what would happen if you want to press Down and B on the same frame.

And

Consider a situation where you want to trigger something upon first press of a button, but not If it's held down.

Example. I had a series of screens at the beginning of my game, where 'Start' would go from one screen to the next. With your setup, it would zip through all of the screens in a few frames if you held down the Start button.

Thus, I also needed to remember the buttons from the previous frame as well.


Valid point for #1. I guess I should handle dealing with the button pressed on an as needed basis. As for point #2, I hadn't really thought of that. I guess I would need to keep more than a single frame and compare between frames as well as have a flag to determine if the action is being performed.

Page 2 of 2 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/