Opening Animations

Hi All,


First time poster. I'm currently working on a little project for my children. I'm slowly working through SumRndmDde's tutorials and writing notes for myself to refer back to when I plan to implement that aspect of the tool-set into my game.


I've got some (limited) professional experience with scripting/coding so the explanation doesn't need to be too basic but: I have a question about the opening animations for chests.


Can someone please explain to me the logic behind the below instructions displaying the opening animations of a chest? I would expect to have to apply the partially opened chest images at specific points of the code. (The below was created from Quick Event Creation: Treasure)


1. Direction Fix Off 2. Turn Left 3. Wait: 3 frame(s) 4. Turn Right 5. Wait: 3 frame(s) 6. Turn Up 7. Wait: 3 frame(s) 


Appreciate whatever help anyone can give.


Cheers


Kelewan
The reason is the way the sprites are structured - look at the sprite of an NPC, that has four directions and the person is looking into that direction depending on the row.


Now if you look at the chest - the engine doesn't know that it is a chest, for it all sprites have the same four rows standing for the same four directions.


So if you want the picture of a certain row displayed, you tell the engine to "turn in that direction" and the engine translates that internally to "use pictures of row number n" depending on the direction.


But for the human developer it is easier to read that as a direction instead of a number, because most sprites are persons or animals that go in the four directions.


And you might also follow the link "starting point" in my signature to get to the basic tutorials and the most important tips of using the RM's.
Explaining bit by bit:


Direction Fix Off -> If the event has direction fix on, it will not turn. Most events are set like npcs, so they turn when you activate them from the side... which for some events with different graphics for each side that you don't want to change means it does changes. So you set a checkbox to fix the direction so it doesn't change no matter the side interacted with.


The downside is that, when you want them to change direction, you have to turn the direction fix off.



Turn Left/Right/Up -> a chest, unlike an npc, had a different position for the opening depending on its side. usually down is fully closed, left is a bit open, right is more open, and up is fully open. This makes the chest turn left.



Wait: 3 frame(s) -> this makes the event wait three frames before continuing, in this case to change directions. The game usually runs at 60 frames per second, so without this human eyes would not even notice the change if the wait wasn't there. For a slower opening, increase the wait.

Original thread: https://forums.rpgmakerweb.com/threads/opening-animations.71088/