Aligning frames

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Yakka
Inhabitant of a Conurbation
Reactions:
Posts: 413
Joined: 06 Jan 2020, 09:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Aligning frames

#1

Post by Yakka »

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
wh_visual.png (2.56 KiB) Viewed 2390 times

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
xy_visual.png (3.53 KiB) Viewed 2390 times

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.
Last edited by Yakka on 06 Mar 2023, 21:08, edited 2 times in total.

User avatar
burgernamn
Former aster dude
Reactions:
Posts: 172
Joined: 15 Apr 2022, 10:32
Plugins: Showcase Store

Plugin Creator

Platform

Re: How to align frames in theotown

#2

Post by burgernamn »

extremely useful my fren

User avatar
ur_sc4_guy
Metropolitan
Reactions:
Posts: 135
Joined: 16 Jun 2022, 20:01
Location: Any ambanivohitra any e, Madagascar
Plugins: Showcase Store

Plugin Creator

Platform

Re: Aligning frames

#3

Post by ur_sc4_guy »

Nice tutorial

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”