Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Question about using of the keyboard  (Read 3747 times)

0 Members and 1 Guest are viewing this topic.

benkovici

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
Question about using of the keyboard
« on: February 18, 2009, 04:45:18 PM »

Hello!
In my game I would like some event to happen after the player presses a button, but I don't know exactly how to do this. Here is my code:

on "eye"
{
 actor.GoTo(597, 484);
 actor.TurnTo("DI_UPRIGHT");
 Game.Interactive = false;
 actor.Talk("Oh God! I don't wanna do this");
 actor.Direction = DI_DOWN;
 Sleep(700);
 actor.Talk("Give me a sign");
 actor.Talk("Press Y to oblige");
 actor.Talk("Press N to take pity on mental state");
 var button;
 var VK_Y;
 var VK_N;
  if(Keyboard.IsKeyDown(VK_Y))
 {
  button.Press(VK_Y);
    actor.Talk("Why do you do this to me?");
  actor.Direction = DI_UPRIGHT;
  Game.PlaySound("sound\event.ogg");
  var ent = Scene.GetNode("toy_big");
    ent.Active = true;
   this.Active = false;
   Game.TakeItem("mask");
   var EntMask = Scene.GetNode("mask");
  EntMask.Active = false;
 }
  else if(Keyboard.IsKeyDown(VK_N))
  {
    button.Press(VK_N);
    actor.Talk("Thanks for saving my mental state");
  }
  Game.Interactive = true;
}
 -----------------------
I also tried to use VK_UP and VK_DOWN cause I thought that if VK_N and VK_Y aren't mentioned in keys.inc, they might not work. But something is not right with my code. Could you help me please?
Logged

benkovici

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 23
    • View Profile
Re: Question about using of the keyboard
« Reply #1 on: February 20, 2009, 02:09:13 AM »

I solved it myself. ::rock
Logged

sychron

  • Wanderer zwischen den Welten
  • Global Moderator
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 223
  • There is no spoon. The enemy gate is down!
    • View Profile
Re: Question about using of the keyboard
« Reply #2 on: February 22, 2009, 05:07:45 PM »

go ahead, tell us ;-)
Logged
... delete the inner sleep ...
 

Page created in 0.059 seconds with 20 queries.