Animations: Determining coordinates?

Plug-in related stuff can be discussed here.

Moderator: Bearbear65

Post Reply
User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 843
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

Animations: Determining coordinates?

Post by mdk_813 » Tue Aug 22, 2017 23:48

So, after Lobby's information on blinking lights (see here: viewtopic.php?p=49384#p49384 )
I decided to make a test plugin with a small blinking light made by myself. It is basically a small 1x1 boie with draw ground that builds on water.
After some trial and error I was able to determine that in this case, the coordinates must be "x":14,"y":-9. However, I cannot figure out the system behind it. Why does the game want these coordinates? Because they differ from what I've counted out by using the method provided here: viewtopic.php?f=41&t=1215

How do I determine the pivot point from where to count pixels? Is it a different point, if there is no ground texture?

The json looks like this (it works as intended):

Code: Select all

[
   {
      "id":"TestbojeNEU.mdk_813",
	  "type":"decoration",
	  "author":"mdk_813",
       "width":1,
	  "height":1,
	  "frames":[{"bmp":"TestbojeNEU_1x1.png"}],
       "animation":[{"id":"MyRedLight_5x5.mdk_813","x":14,"y":-9}],
	  "price":1,
	  "monthly price":1,
       "draw ground":true,
	  "water":"0",
	  "power":"0",
       "build time":0,
	  "needs road":false,
	  "needs water":true,
	  "needs land":false,
	  "title":"TestbojeNEU",
	  "text":"Will it blink?"
   }
]
This is an enlarged image to illustrate how I intially counted (the yellow pixel is where the animation should be):
TestbojeNEU_1x1_Coordinates.png
TestbojeNEU_1x1_Coordinates.png (3.31 KiB) Viewed 707 times

This is the original plugin png.
TestbojeNEU_1x1.png
TestbojeNEU_1x1.png (2.85 KiB) Viewed 707 times

This is the complete plugin:
TestbojeNEU.zip
(6.72 KiB) Downloaded 43 times
My Plugins: Link

PLEASE NOTE: My plugins are not open source! So, ask me first before altering and republishing any of my plugins!

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5861
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Animations: Determining coordinates?

Post by CommanderABab » Wed Aug 23, 2017 0:33

I think the house smoke is a 1x1 or 3x3 animation. Since yours is 5x5, the x and y values are going to be smaller by the difference in the sizes to get it centered the same on the same point.
497497Currently using 497. 497 What's new? :)
Save bug squashed!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 843
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

Re: Animations: Determining coordinates?

Post by mdk_813 » Wed Aug 23, 2017 1:08

CommanderABab wrote:
Wed Aug 23, 2017 0:33
I think the house smoke is a 1x1 or 3x3 animation. Since yours is 5x5, the x and y values are going to be smaller by the difference in the sizes to get it centered the same on the same point.
Thanks, that might be the explanation.
However, wouldn't you expect the same differences for the x- and the y-coordinate then, between what I have expected and what I actually needed to set? After all the size of my animation is proportional to the size of the ingame animation.
It it strange really. Maybe I overlook something, but it seems like finding the coordinates is merely a guessing game, and I'm quite sure, it shouldn't be.
My Plugins: Link

PLEASE NOTE: My plugins are not open source! So, ask me first before altering and republishing any of my plugins!

User avatar
CommanderABab
Inhabitant of a Multiverse
Reactions:
Posts: 5861
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Re: Animations: Determining coordinates?

Post by CommanderABab » Wed Aug 23, 2017 3:23

Try centering animations of the same image at different sizes within a 32x32 then using handle x and handle y then :). Then doing that, but making it appear as a pyramid.
497497Currently using 497. 497 What's new? :)
Save bug squashed!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 843
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

Re: Animations: Determining coordinates?

Post by mdk_813 » Wed Aug 23, 2017 4:22

Thank you, I'll try that.
My Plugins: Link

PLEASE NOTE: My plugins are not open source! So, ask me first before altering and republishing any of my plugins!

User avatar
rjroldan1
Inhabitant of a Conurbation
Reactions:
Posts: 394
Joined: Mon Jul 17, 2017 16:16
Location: philippines
Plugins: Show
Contact:

Re: Animations: Determining coordinates?

Post by rjroldan1 » Wed Aug 23, 2017 6:13

are you making firecracker fountain?
Silent

President of Metropole region

____________________________________________________________________________________
I LOVE PHILIPPINES

User avatar
Lobby
Developer
Reactions:
Posts: 2970
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Animations: Determining coordinates?

Post by Lobby » Fri Sep 01, 2017 21:25

coord.png
coord.png (1.4 KiB) Viewed 614 times
It's exactly as @CommanderABab said. It might be confusing though because of the use coordinate system.
...Have a nice stay

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 843
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

Re: Animations: Determining coordinates?

Post by mdk_813 » Fri Sep 01, 2017 22:53

@Lobby
Thank you for the clarification.

After looking at your example, I think what's making it confusing is that the coordinates are determined in reference to the upper-left corner of the animation.
So in this case here, you would have to count to the near edge of the animation to get the x-value, while for the y-value you would have to count to the far edge of the animation. This is probably not what you would expect by intuition.
My Plugins: Link

PLEASE NOTE: My plugins are not open source! So, ask me first before altering and republishing any of my plugins!

User avatar
Lobby
Developer
Reactions:
Posts: 2970
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone: S7 edge

Re: Animations: Determining coordinates?

Post by Lobby » Sat Sep 02, 2017 22:07

The handle is by default always in the upper left corner except for building frames (and road frames). It's a good practice to move the handle to a meaningful position for animations using "handle x" and "handle y" (for example to the center).

I have to admit that I didn't always follow this myself. For example the pre-defined animations use the default handle.
...Have a nice stay

Post Reply

Return to “Plug-In Discussion”

Who is online

Users browsing this forum: fbarraza28 and 3 guests