Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: swaz on Mon 13/08/2007 20:48:00

Title: How to show a door open/closed
Post by: swaz on Mon 13/08/2007 20:48:00
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.
Title: Re: How to show a door open/closed
Post by: Candall on Mon 13/08/2007 21:02:17
If you'd prefer to use an object instead of a hotspot, you could just change the graphic property for the door.  For example:


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.
Title: Re: How to show a door open/closed
Post by: swaz on Tue 14/08/2007 16:39:44
Thank you!
Title: Re: How to show a door open/closed
Post by: Candall on Wed 15/08/2007 13:44:24
You're quite welcome.
Title: Re: How to show a door open/closed
Post by: swaz on Thu 16/08/2007 02:53:14
Quite? :D
Title: Re: How to show a door open/closed
Post by: ciborium on Tue 21/08/2007 23:26:51
http://dictionary.reference.com/browse/quite