Rotation aware night animations.

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4313
Joined: 14 Sep 2017, 15:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Rotation aware night animations.

Post by THEMAX »

Rotation aware night animation
There has been lately a lot of persons asking how to make night animations on the discord, therefore i'll post a tutorial on how to make night animations rotation aware, but first, a few details :

-Rotation aware buildings can only have 2 or 4 frames, the same apply for rotation aware light animations. Otherwise, you might not get the expected result.
-This tutorial will admit you have already created 2 distinct png, one with the rotations of your prop / building, and another with the night animations, just like I did with the newspaper kiosk right under, which i'll use as an example.
Themax_PrpDecs1_Paris_Newspaper_Kiosk1.png
Themax_PrpDecs1_Paris_Newspaper_Kiosk1_Night.png

Code: Select all    Reset

[ { "id": "$Themax_PrpDecs1_Paris_Newspaper_Kiosk1_Night", "type": "animation", "light": true, "light switching": true, "frames": [ { "bmp": "Themax_PrpDecs1_Paris_Newspaper_Kiosk1_Night.png", "count": 4, "h": 32, "w": 32 } ], "rotation aware": true }, { "id": "$Themax_PrpDecs1_Paris_Newspaper_Kiosk1", "type": "decoration", "category": "$cat_Themax_Props_And_Decorations_0", "author": "Themax", "width": 1, "height": 1, "frames": [ { "bmp": "Themax_PrpDecs1_Paris_Newspaper_Kiosk1.png", "count": 4, "h": 32, "w": 32 } ], "animation": [{"id": "$Themax_PrpDecs1_Paris_Newspaper_Kiosk1_Night", "x":0,"y":-25}], "price": 400, "monthly price": 0, "rotation aware": true, "draw ground": true, "water": "0", "power": "0", "build time": 0, "ordinal": 101, "needs road": false, "text": "A newspaper kiosk based on those you can find in Paris.", "title": "Paris newspaper kiosk" } ]
JSON checker
Check
Here is our json, the way i proceed is to first add a night-animation part, and set up a single frame sheet with "count", "h" & "w" corresponding to the total width of my png divided by 4, plus a "rotation aware": true (mandatory, otherwise it wont work).

Once that is done, adds an animation line to your json and you should be good to go, adjust the "y" part accordingly so it match your texture.

There you go, you have a basic json for a rotation aware building with night animations. In addition, this functionnality works also for cars, and it can really lower the work burden if done correctly, at the expanse of a sometimes bigger plugin texture space usage, for this reason, i would recommend not using this solution for plugins that have a large size.

If i discover other, better ways to make rotation aware night animations, i'll post about those.
You do not have the required permissions to view the files attached to this post.
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact
User avatar
Bearbear76
Inhabitant of a Multiverse
Reactions:
Posts: 5701
Joined: 10 Feb 2017, 12:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: Rotation aware night animations.

Post by Bearbear76 »

Great documentation! :)
Just my opinion
retired
User avatar
Kulche
Inhabitant of a Continent
Reactions:
Posts: 1194
Joined: 07 Jun 2017, 18:28
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Rotation aware night animations.

Post by Kulche »

Didn't really know that rotation aware could be used for animations. You might as well use "frame": index in your animation object for greater control :)
get yoked!!
User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4313
Joined: 14 Sep 2017, 15:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Rotation aware night animations.

Post by THEMAX »

Kulche wrote: 28 Apr 2021, 13:29 Didn't really know that rotation aware could be used for animations. You might as well use "frame": index in your animation object for greater control :)
I just discovered about that but I haven't mastered it enough to make a tutorial yet. Will come soon, most likely.
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact
Previous topicNext topic