Creating an Elevator Object

Started by ZacksQuest, Sun 19/06/2011 19:37:49

Previous topic - Next topic

ZacksQuest

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);
}
Current projects:

ZORK I: THE VGA GRAPHICAL REMAKE (Now with EVEN MORE puzzles, MORE story and character development, and SO MUCH CHEESE!)
Here is the site... yay for advertising!-> http://thegreatundergroundempirevga.webs.com/index.htm

barefoot

#1
Hi

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



barefoot
I May Not Be Perfect but I Have A Big Heart ..

Khris

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.

Code: ags
  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:

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


You didn't mention what exactly your problem is so I hope this helps.

ZacksQuest

It's okay. I got it... sorta. Anyways, it works, and that's the good thing.
Current projects:

ZORK I: THE VGA GRAPHICAL REMAKE (Now with EVEN MORE puzzles, MORE story and character development, and SO MUCH CHEESE!)
Here is the site... yay for advertising!-> http://thegreatundergroundempirevga.webs.com/index.htm

SMF spam blocked by CleanTalk