I have a trapdoor and I want it to look opened when you interact with it. I have the trapdoor in the background. How do I make it look opened?
Use objects. The opened trapdoor can then be made visible when you want it to look opened and invisible when it's closed.
Read the manual for more information on objects, how to create those and how to make them (in-)visible.
And welcome to the forums!
Thanks :)
Hmm... but the trapdoor isn't invisible at all... So it is visible all the time. You can see when it is closed and opened.
I'm afraid, I don't quite understand.
Do you mean, that the "new" trapdoor that you added as object is always visible (wich would mean that the trapdoor always looks opened)?
Then make sure to deselect the "Object is initially visible"-checkbox!
Sorry if I dont make any sense :D
I mean that the door in the floor is always visible. I just want it to show a graphic door closed if you havent opened it yet. When you open it, the graphic of the door changes into a opened door.
Ah, then you need to use object.Graphic to set the spriteslot number to the opened/closed image of the trapdoor whenever the player opens or closes it!
Hmm. Could you give me a sample how to use object.Graphic.
I have putted that the game runs a script when player uses a inventory item on the object. But what do I type to the script? oTrapdoor.Graphic(the_sprite_slot);?
Allright, allright. :D
I suppose you have already imported your "trapbox open" and "trapbox closed" images into the sprite manager!? Open the sprite manager and take a look at those two images: notice the number? Remember this number for the opened and closed image.
Now when the player opens the trapbox, add an interaction and choose "run script". Then click on "edit script" and add this line:
oTrapbox.Graphic = 562;
You need to use AGS 2.7 or greater for this to work. Also replace "562" with the number that you remembered before for the open image. Also make sure that your trapbox object is actually named "trapbox, so that the script-o-name is "oTrapbox"!
Then you do the same for when the player closes the trapbox and add the line of code, just make sure to change the number to the one you remembered for the closed image.
Easy as this. Ask if you have further questions!
Ahh... Thank you... I'm familiar with scripting but I just didn't know how to give the graphic value to the object :)