Using an inventory item to make an object change image...

Started by teenage_musings, Tue 27/05/2008 14:20:42

Previous topic - Next topic

teenage_musings

 ??? I was wondering if it would be possible to script it so an item that clicked on an object would be able to change the object's image.

Example: (image of wardrobe closed -- click with item such as key --> image of open wardrobe)

If so, how would you script it? Some help would be much appreciated.

Snake

If it is the wardrobe being open and closed, you could simply turn the objects (wardrobe open, wardrobe closed) on and off.

Example:
Wardrobe Closed - Object 1
Wardrobe Open - Object 2
Code: ags

//player clicks key on object 1
Display("You use the key to open the wardobe...");
object[1].Visible=false;
object[2].Visible=true;


Then for when the player interacts with object 2, run whatever script you'd like.

I hope this helps,

//--EDIT--//
There is another way to do it. You can directly change the image of the object and keep the object the same. Then just use local/global variables to tell when the image has changed. I can't remember which command it is, but it's in the manual somewhere.

//--EDIT 2--//

Here it is:
Code: ags

object[1].Graphic = 100;

Whichever object the Wardrobe is and whatever sprite slot the sprite is in (in the sprite manager - the number under the image).


--Snake
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

SMF spam blocked by CleanTalk