It is currently Sat May 26, 2018 6:42 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Jan 27, 2018 7:48 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2053
Location: DIGDUG
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.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sat Jan 27, 2018 8:18 pm 
Offline
User avatar

Joined: Sat Sep 27, 2014 10:10 pm
Posts: 30
Location: Houston, TX
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group