Animations: Determining coordinates?

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Animations: Determining coordinates?

#1

Post 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 3782 times

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

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

User avatar
CommanderABab
AB
Reactions:
Posts: 11086
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Animations: Determining coordinates?

#2

Post 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.

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: Animations: Determining coordinates?

#3

Post 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.

User avatar
CommanderABab
AB
Reactions:
Posts: 11086
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Animations: Determining coordinates?

#4

Post 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.

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: Animations: Determining coordinates?

#5

Post by mdk_813 »

Thank you, I'll try that.

User avatar
Hadestia
Inhabitant of a Megalopolis
Reactions:
Posts: 727
Joined: 17 Jul 2017, 16:16
Location: Philippines
Plugins: Showcase Store
Contact:

Plugin Creator

Platform

Re: Animations: Determining coordinates?

#6

Post by Hadestia »

are you making firecracker fountain?

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Animations: Determining coordinates?

#7

Post by Lobby »

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

User avatar
mdk_813
Inhabitant of a Country
Reactions:
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: Animations: Determining coordinates?

#8

Post 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.

User avatar
Lobby
Developer
Reactions:
Posts: 3705
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Animations: Determining coordinates?

#9

Post 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.

Post Reply Previous topicNext topic

Return to “Plug-In Discussion”