Hello, it is I, Lo_Res_Man or LRM as I have been called recently.
I was wondering how one would implement a dragons lair type action scene? Not as detailed of course but still going with the idea of pressing the right button at the right time. What would be the easiest way to implement this? and remember I am a complete programming noob.
int counter, hit;
function repeatedly_execute () {
counter ++;
if (counter < 100) {
if (IsKeyPressed (99)) Display ("Too early!"); // die
} else if (counter < 150) {
if (IsKeyPressed (99)) {
Display ("Whack!");
hit = 1;
}
} else if (hit == 0) {
Display ("Too late!"); // die
}
}
Thankyou Radiant. ah phooey, maybe someone should put this in 'beginners' cuz I am still confused. how would one add say something more then just a text congratulation.
Here's the same code, just with a bit more space and comments :)
int counter, hit;
function repeatedly_execute () {
counter ++;
if (counter < 100) {
if (IsKeyPressed (99)) {
Display ("Too early!"); // die
//Do whatever else you want to do in here if the player dies
//because he presses the key too early
}
} else if (counter < 150) {
if (IsKeyPressed (99)) {
Display ("Whack!");
hit = 1;
//Do whatever you want when you whack the person here.
}
} else if (hit == 0) {
Display ("Too late!"); // die
//Do whatever you want when you wait too long to whack the person.
}
}
OHHHHH!!! Thanks, somehow it makes more sense now :-[, sorry for the trouble.