Game Maker Studio: How to Deactivate & Reactivate Keyboard Key’s after getting Hit.
Visit my anime and game site: http://mcanime1.wixsite.com/mcanime
GMX file: https://bit.ly/2L2tdX7
Moveright:
Events:
Collision with Spike:
Action:
keyboard_clear(vk_right,)
keyboard_set_map(vk_right,"")
This top code will deactivate your keyboard key moving right, don't forget to put in the other movements as well as the weapon button. For an example: vk_enter, maybe used to fire weapon.
So when he gets hit by the spikes, he will switch to getting hit image for so many seconds. One of the getting hit images going right is called "object37". After so many seconds he will blink meaning he is getting hit.
Object37:
Event:
Create:
Actions:
Set Alarm 0 to room_speed*1
Events:
Alarm 0
Actions:
Set Alarm 0 to room_speed*1
keyboard_set_map(vk_right,vk_right)
The top code above is for moving right, don't forget to put in the other movements and button you will us to fire, this will allow the keyboard keys to work again.