Dragons Lair type action sequences

Started by lo_res_man, Mon 03/09/2007 21:55:32

Previous topic - Next topic

lo_res_man

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.
†Å"There is much pleasure to be gained from useless knowledge.†
The Restroom Wall

Radiant

Code: ags

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
  }
}


lo_res_man

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.
†Å"There is much pleasure to be gained from useless knowledge.†
The Restroom Wall

VK Dan

Here's the same code, just with a bit more space and comments :)

Code: ags

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.

  }
}

lo_res_man

OHHHHH!!! Thanks, somehow it makes more sense now :-[, sorry for the trouble.
†Å"There is much pleasure to be gained from useless knowledge.†
The Restroom Wall

SMF spam blocked by CleanTalk