How to show a door open/closed

Started by swaz, Mon 13/08/2007 20:48:00

Previous topic - Next topic

swaz

Hi all,
using AGS i asked myself how to show a door open/closed.
Someone suggested me to create a new object with the door open, for example, to make it visible when the player opens the closed door (which is an hotspot, instead).
I'd like to know if there are other ways to do that.

Candall

If you'd prefer to use an object instead of a hotspot, you could just change the graphic property for the door.  For example:

Code: ags

function WhenTheDoorIsUsed(){
  if (oDoor.Graphic=11){
    oDoor.Graphic=12;
  }
  else {
  oDoor.Graphic=11;
  }
}


oDoor would be the name of the door object, 12 would be whatever sprite slot the open door animation is set to, and 11 would be the sprite slot for the closed door animation.

What this is going to do is test to see whether the door is open or closed and then switch it to the opposite state accordingly.


Candall




SMF spam blocked by CleanTalk