Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: lo_res_man on Mon 03/09/2007 21:55:32

Title: Dragons Lair type action sequences
Post by: lo_res_man on Mon 03/09/2007 21:55:32
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.
Title: Re: Dragons Lair type action sequences
Post by: Radiant on Mon 03/09/2007 21:58:40

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

Title: Re: Dragons Lair type action sequences
Post by: lo_res_man on Mon 03/09/2007 23:20:09
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.
Title: Re: Dragons Lair type action sequences
Post by: VK Dan on Tue 04/09/2007 02:40:31
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.

  }
}
Title: Re: Dragons Lair type action sequences
Post by: lo_res_man on Tue 04/09/2007 07:24:50
OHHHHH!!! Thanks, somehow it makes more sense now :-[, sorry for the trouble.