Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Surplusguy on Mon 20/05/2013 02:21:50

Title: SOLVED: Panic Button
Post by: Surplusguy on Mon 20/05/2013 02:21:50
So, in my game you're chased by someone. I'd like there to be a quicktime event you can use to avoid getting killed if you run into them (in this case tapping the spacebar repeatedly). So far, I have this: on Overlap with cMonster, cEgo stops. A timer starts, which after about 5 seconds checks if a bool variable has been switched. If IsKeyPressed (eKeySpace) = true, the variable is switched and cEgo moves away from the monster, displaying a view of pushing it away. If not, and the variable stays as it is, a view displays of cEgo dying and the game returns to the menu. This is all well and good if you just want the defense to be pushing the spacebar once, but I'd like it to be repeated. Any pointers as to how to do this? Much appreciated!  :)

Title: Re: Panic Button
Post by: san.daniele on Mon 20/05/2013 10:29:31
wouldn't it work to just use an INT instad of BOOL? every hit on space = INTspace++. If INTspace >= 5 push monster away, else die.
Title: Re: Panic Button
Post by: Surplusguy on Mon 20/05/2013 22:06:10
mm, yes. I was considering using an int to make it so when the spacebar was pressed it would go up by one. but i wasn't aware of the function allowing it to go up by one without direct numbering. thanks daniele! :)