Difference between revisions of "Pikifen/Object categories/Scale"
Revision as of 13:31, 8 February 2020
Scales are objects that can measure how much weight is on top of them, and change freely based on that amount. Numbers can appear above the object indicating how much weight is on top of it now, and optionally, how much weight is required to trigger something. Any object can weigh down a scale object.
Examples of scale types include seesaw blocks, where one block weighing more than the other causes that one to sink and the other to rise, or crushable paper bags, that block the way until enough weight is put on them to crush them.
To create a new type of scale, please follow the creating object types tutorial.
A scale object can be anything and do anything, but it can also have information to show a goal weight number above it. Objects of this category should worry about checking how much weight is atop them, and change accordingly.
Other than that, scale objects are hardcoded in the engine to do whatever the script tells them.
Besides the global object type attributes, a scale type has the following attributes.
goal_number: If not zero, the numbers above the object will be a fraction with the bottom number being this "goal" amount. Defaults to 0.
Scale object types do not need any specific animations, only the ones that you call in the script.
All of the scale type object's behavior is defined by the user-made script. You should be using the
on_weight_removed events to know when the weight atop a scale has changed, and also use the
get_info action to know what the current weight is.
Object spawn script variables
Besides the global spawn script variables, scale type objects do not read any specific script variables.