How to use animation

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

How to use animation

#1

Post by Thiên Ân »

Help me with the windturbine fan how can i add it in json?
User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

Re: Advanced tags for building plugins

#2

Post by Thiên Ân »

How to make the fan of wind turbine rotate?
User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#3

Post by Lobby »

Here's part of the definition for the in-game wind turbine:

Code: Select all    Reset

[ { "id":"$animationfan00", "type":"animation", "frames":[{"bmp":"blades.png","w":60,"h":58,"count":6}] }, { "id":"$windturbine00", "type":"energy", "width":3, "height":3, "frames":[{"x":1792,"y":1264,"w":96,"h":96}], "animation":[ {"id":"2x2l", "x":67, "y":-2}, // Some light for night mode {"id":"$animationblinkingredlight3x3","x":23,"y":-71}, // A blinking red light for decoration {"id":"$animationfan00","x":7,"y":-94} // Our previously defined blades ], // ... } ]
JSON checker
Check
The blades:
blades.png
blades.png (5.13 KiB) Viewed 2119 times
User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

Re: Advanced tags for building plugins

#4

Post by Thiên Ân »

I have written json like that but it doesn't work. Can you explain why you use w, h in both frame and count in animation?
User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#5

Post by Lobby »

"doesn't work" is not exactly helpful for us to diagnose the issue.

In the animation I specify width and height explictily so that the game knows the size of a single frame. It then uses count to extract that amount of frames. These will then be used to play the animation.
User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

Re: Advanced tags for building plugins

#6

Post by Thiên Ân »

I saw some pluggin didnt use w and h. How do you know w h of a plugin
User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

Re: Advanced tags for building plugins

#7

Post by Thiên Ân »

Lobby wrote: 04 Aug 2022, 17:49 "doesn't work" is not exactly helpful for us to diagnose the issue.

In the animation I specify width and height explictily so that the game knows the size of a single frame. It then uses count to extract that amount of frames. These will then be used to play the animation.
Oke i have done it. How do you know that is the perfect w and h to display each blades of the blades frame and why the game doesn't display all 6 blades if i use this code.
User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: How to use animation

#8

Post by Lobby »

I made the graphics so that each subframe has this size. It should display all of the 6 frames with this code as it does in the game.
User avatar
Thiên Ân
Villager
Reactions:
Posts: 16
Joined: 07 Jul 2022, 21:23

Re: How to use animation

#9

Post by Thiên Ân »

Lobby wrote: 05 Aug 2022, 09:49 I made the graphics so that each subframe has this size. It should display all of the 6 frames with this code as it does in the game.
I mean the whole 6 blades will visible on a row on map after i built thể turbine if i don't use h, w, count.
User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: How to use animation

#10

Post by Lobby »

By using w, h you tell the game the size of individual frames of the animation. The game will then try to get count many such frames from the provided image. The game will not calculate w, h automatically for count>1
Post Reply Previous topicNext topic

Return to “Plug-In Discussion”