Animations: Determining coordinates?

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

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

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 1899 times

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

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

Update Sep 12, 2020:
As I am not really active here anymore, I am not able to answer any PMs in time.
So, as long as you mention me in the plugin and the description, feel free to use or modify my plugins for your own creations.

User avatar
CommanderABab
AB
Reactions:
Posts: 9374
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

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.
...............:) .Image

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

Platform

Re: Animations: Determining coordinates?

#3

Post by mdk_813 »

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

Update Sep 12, 2020:
As I am not really active here anymore, I am not able to answer any PMs in time.
So, as long as you mention me in the plugin and the description, feel free to use or modify my plugins for your own creations.

User avatar
CommanderABab
AB
Reactions:
Posts: 9374
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

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.
...............:) .Image

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

Platform

Re: Animations: Determining coordinates?

#5

Post by mdk_813 »

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

Update Sep 12, 2020:
As I am not really active here anymore, I am not able to answer any PMs in time.
So, as long as you mention me in the plugin and the description, feel free to use or modify my plugins for your own creations.

User avatar
rjroldan1
Inhabitant of a Megalopolis
Reactions:
Posts: 653
Joined: Mon Jul 17, 2017 16:16
Location: Philippines
Plugins: Show
Contact:

Platform

Plugin Creator

Re: Animations: Determining coordinates?

#6

Post by rjroldan1 »

are you making firecracker fountain?

.╔═╗─────────────╔╗────────
║╬║─╔╗╔╦╗╔═╗╔╗─╔╝║╔═╗─╔═╦╗
║╗╣─╠╣║╔╝║╬║║╚╗║╬║║╬╚╗║║║║
╚╩╝╔╝║╚╝─╚═╝╚═╝╚═╝╚══╝╚╩═╝
───╚═╝────────────────────
T.P.C.
Theotown Philippine Corporation
Plugin creator Doesn't had Cities

User avatar
Lobby
Developer
Reactions:
Posts: 3648
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

Platform

Re: Animations: Determining coordinates?

#7

Post by Lobby »

coord.png
coord.png (1.4 KiB) Viewed 1806 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: 860
Joined: Fri Dec 16, 2016 2:38
Location: Germany
Plugins: Show

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.
My Plugins: Link

Update Sep 12, 2020:
As I am not really active here anymore, I am not able to answer any PMs in time.
So, as long as you mention me in the plugin and the description, feel free to use or modify my plugins for your own creations.

User avatar
Lobby
Developer
Reactions:
Posts: 3648
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
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”