Hi.. I'm a pretty new programmer and I'm new to sega genesis and game programming in general. I'm using sgdk
I want to know, how can you detect if a button is held down and constantly do something while it is held down. for instance moving a character right while the right button is held down?
I looked into the sgdk joypad handling source code and it says it updates controller state at each vblank period and only fires an event whenever a state change is detected.
Controller button held down
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Hi,
You should look into the sample source code.
The cube flat example exactly do what you want to do to make the cube spinning faster or slower :
http://code.google.com/p/sgdk/source/br ... lat/main.c
The method you have to use is
so it returns the current button state of the specified joystick.
You should look into the sample source code.
The cube flat example exactly do what you want to do to make the cube spinning faster or slower :
http://code.google.com/p/sgdk/source/br ... lat/main.c
The method you have to use is
Code: Select all
joyState = JOY_readJoypad(joy_number);