Page 1 of 1

Animations: Determining coordinates?

Posted: 22 Aug 2017, 23:48
by mdk_813
So, after Lobby's information on blinking lights (see here: http://www.theotown.com/forum/viewtopic ... 384#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: http://www.theotown.com/forum/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 3863 times

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

This is the complete plugin:
TestbojeNEU.zip
(6.72 KiB) Downloaded 230 times

Re: Animations: Determining coordinates?

Posted: 23 Aug 2017, 00:33
by CommanderABab
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.

Re: Animations: Determining coordinates?

Posted: 23 Aug 2017, 01:08
by mdk_813
CommanderABab wrote:
23 Aug 2017, 00: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.

Re: Animations: Determining coordinates?

Posted: 23 Aug 2017, 03:23
by CommanderABab
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.

Re: Animations: Determining coordinates?

Posted: 23 Aug 2017, 04:22
by mdk_813
Thank you, I'll try that.

Re: Animations: Determining coordinates?

Posted: 23 Aug 2017, 06:13
by Hadestia
are you making firecracker fountain?

Re: Animations: Determining coordinates?

Posted: 01 Sep 2017, 21:25
by Lobby
coord.png
coord.png (1.4 KiB) Viewed 3770 times
It's exactly as @CommanderABab said. It might be confusing though because of the use coordinate system.

Re: Animations: Determining coordinates?

Posted: 01 Sep 2017, 22:53
by mdk_813
@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.

Re: Animations: Determining coordinates?

Posted: 02 Sep 2017, 22:07
by Lobby
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.