Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ZacksQuest on Sun 19/06/2011 19:37:49

Title: Creating an Elevator Object
Post by: ZacksQuest on Sun 19/06/2011 19:37:49
Okay, in my test game that's going to show off my programming (which I have some experience in, just... not too much) using the insta-game space pack. I'm trying to make it so my character calls an elevator (this is working fine), the elevator comes down (again, working fine), the character gets on the elevator (this is the problem), and then the character and the elevator go up simultaneously (again, another problem). Here is the script so far. Can someone tell me how to finish the script, for the manual sort of... confused me.

function oControlpanel_Interact()
{
cStereo.Walk(212, 171, eBlock, eWalkableAreas);
cStereo.Say("Computer, send Elevator 1 to room 208. Stat.");
oElevator.Move(236, 152, 2, eBlock, eAnywhere);
}
Title: Re: Creating an Elevator Object
Post by: barefoot on Sun 19/06/2011 20:04:57
Hi

eBlocking commands must finish before anything else happens..  eNoBlocking commands don't so other stuff can run as well.



barefoot
Title: Re: Creating an Elevator Object
Post by: Khris on Sun 19/06/2011 21:00:03
What I would do is draw a second walkable area at the spot where the elevator is going to sit.
In the room's "before fadein" or "after fadein", turn the area on/off depending on whether the player can step on it.

  if (oElevator.Y > 140) RestoreWalkableArea(2);
  else RemoveWalkableArea(2);


If the elevator is supposed to go up as soon as the character steps on it, add a region as well and use the region's "player steps on" event.

To move the elevator and player I'd do this:

  while (oElevator.Y > 80) {
    player.y--;
    oElevator.Y--;
    Wait(1);
  }


You didn't mention what exactly your problem is so I hope this helps.
Title: Re: Creating an Elevator Object
Post by: ZacksQuest on Sun 19/06/2011 21:11:10
It's okay. I got it... sorta. Anyways, it works, and that's the good thing.