-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Lua Script API: Object Functions
Used for making an object use a solid color Width x Height frame instead of a texture.
-
obj
- Lua Sprite tag or Object variable name -
width
- Width in pixels of the graphic you want to create -
height
- Height in pixels of the graphic you want to create -
color
- Color string, works the same as getColorFromHex
Example: Use makeGraphic('testBlackSquare', 1000, 1000, '000000')
to make the Lua Sprite with the tag "testBlackSquare" turn into a 1000x1000 black square.
Changes the blend mode of a Sprite (Works similar to how Photoshop do it)
-
obj
- Lua Sprite tag or Object variable name -
blend
- Blend mode to use. Example:add
,darken
,normal
.
Adds an animation name
to the Lua Sprite/Object using the tag/variable tag
, it will also overwrite another animation using the same name.
-
obj
- Lua Sprite tag or Object variable name -
name
- Animation to be added's name -
prefix
- Animation name on the .xml file -
framerate
- Optional value, how many frames per second does the animation have, Default value is24
-
loop
- Optional value, should the animation loop? Default value:true
Adds an animation name
to the Lua Sprite/Object using the tag/variable tag
with the specified indices on indices
, it will also overwrite another animation using the same name.
-
obj
- Lua Sprite tag or Object variable name -
name
- Animation to be added's name -
prefix
- Animation name on the .xml file -
indices
- What frames the animation should use, must be separated with a comma. Example:1, 2, 3, 4, 5, 3, 4, 5
-
framerate
- Optional value, how many frames per second does the animation have, Default value is24
Plays animation name
on a Lua Sprite/Object with the tag/variable obj
.
-
obj
- Lua Sprite tag or Object variable name -
name
- Animation name to play -
forced
- If true, the animation will reset if the current animation is the same as the one you're trying to play. Default value isfalse
Gets the object's layer position
-
obj
- Object variable/Lua Sprite tag
Sets the object's layer position
-
obj
- Object variable/Lua Sprite tag -
position
- New position the object will be in
(note: when referring to characters, you must refer to their group)
boyfriendGroup
, gfGroup
, dadGroup
-
obj
- Group/Array variable -
index
- Member ID -
dontDestroy
- Optional variable. Won't clear member from memory, you will probably never ever use this.
Example: To remove the first spawned note from the group you should use removeFromGroup('notes', 0)
-
obj
- Object from PlayState or Lua Sprite -
multX
- Horizontal multiplier, default value is 1 -
multY
- Vertical multiplier, default value is 1
Works identically to setGraphicSize
Use this to update the hitbox in case you change the sprite's scale manually or via a tween.
-
obj
- Object from PlayState or Lua Sprite
Changes how much a Sprite moves along with the camera.
-
obj
- Lua Sprite tag or Object variable name -
scrollX
- Horizontal movement multiplier -
scrollY
- Vertical movement multiplier
Note: Boyfriend/Opponent have a scrollX/scrollY value of 1, while Girlfriend have a scrollX/scrollY value of 0.95, if you're gonna do background elements, it's highly suggested that you make the values something under 1.
Changes on which camera should your object be drawn on
-
obj
- Lua Sprite tag or Object variable name -
camera
-game
,hud
orother
.