Aligning frames

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Aligning frames

Post by Yakka Works »

Hi, have you ever wondered what x, y, w, h, count is while defining the frames for your plugin?

Well, in this topic, I will explain it the best I can:

w is used to define the width of a frame in a single image file. Example:

Code: Select all

"w": 32 // Image will be 32 px wide

h is used to define the height of a frame in a single image file. Example:

Code: Select all

"h": 32 // Image will be 32 px high
wh_visual.png

x is used to define the coordinate of a frame in an image file, on the x (horizontal) axis.

Code: Select all

"x": 32 // Image will be shifted 32 px to the right

y is used to define the coordinate of a frame in an image file, on the y (vertical) axis. This axis is mirrored.

Code: Select all

"y": 32 // Image will be shifted 32 px down
xy_visual.png

handle is commonly used before x or y, and its function is to align the frame that's displayed in the game (not the image file).

For example:

Code: Select all

"handle x": 8
If the handle x value is negative, then the frame will be shifted to the left. It is not inverted along the y (verical) axis.

For vehicles, you can use v2 to align the frame vertically. For example:

Code: Select all

"v2": [0, 1, 2, 3, 4, 5, 6, 7]
Each number in that array represents a frame of the vehicle, as explained in car tutorial.
count is commonly used when there are several frames in an image file. Defining w is required for this to work. For example, to define 4 frames in an image file:

Code: Select all

"count": 4

copies is commonly used to copy the same file without repeating the same JSON object just to define the same frames. For example, copying the same frames for a one-way road:

Code: Select all

"copies": 3

Additional note: Math and cartesian geometry might be particularly useful while working with those attributes.
You do not have the required permissions to view the files attached to this post.
Last edited by Yakka Works on 06 Mar 2023, 19:08, edited 2 times in total.
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
User avatar
burgernamn
Inhabitant of a Megacity
Reactions:
Posts: 173
Joined: 15 Apr 2022, 08:32
Plugins: Showcase Store

Plugin Creator

Platform

Re: How to align frames in theotown

Post by burgernamn »

extremely useful my fren
im more active on my discord
User avatar
ur_sc4_guy
Metropolitan
Reactions:
Posts: 132
Joined: 16 Jun 2022, 18:01
Location: Any ambanivohitra any e, Madagascar
Plugins: Showcase Store

Plugin Creator

Platform

Re: Aligning frames

Post by ur_sc4_guy »

Nice tutorial
Metalcore lover
Previous topicNext topic