Skip to content
DDR0 edited this page Feb 28, 2012 · 28 revisions

An object has many, many assumed variables. Some of these are flags, which are set at the beginning of the object's life and left alone, while others are properties, and change as the object changes. To change a property, use set('property', value). For example, set('rotate', 45) would cause the object rotate to the 45 degree point. A property can be any type, including integer, decimal (three points of precision), string, list, map, function, or object.

Details

(property name, t=type, p=permissions, units as above, long description, v=verification status; t=verified true, v = verification requested, ?=murky, or x=false.)

General Properties:

These properties are available on all objects.

property t p units purpose v
%PROTO% r This inserts the entirety of an object's prototype's event-handler of the same name, into the place where you type it - just as if you'd copy-pasted it into that spot. Because frogatto requires anything consisting of two commands to be expressed as a list, the usual idiom for this will be [%PROTO%, do_other_stuff_specific_to_this_object_type() ] For those familiar with object-oriented programming, this is like calling a superclass's implementation of a function inside a subclass's implementation. See swallow_event() for the opposite effect. t
accel_x i rw centipixels/frame The acceleration in the object horizontally, relative to its facing; positive values accelerate it forward, negative accelerates it backwards. Note: to accelerate on the x axis (y is exempt from this), an object must have traction of some kind. t
accel_y i rw centipixels/frame The acceleration in the object vertically. A positive value indicates the object is accelerating downwards.
activation_area l w list A list containing a rectangle defined by it's upper-left and lower-right corners. When this rectangle intersects with the screen area, the object becomes active.
alpha i rw 0-255 The opacity of the object, where 0 is transparent, and 255 opaque. v
animation s rw name What animation the object is currently in. Note that setting this property resets time_in_frame to 0, as well as same other processing. v
attached_objects l rw objects A list containing strings that name any objects attached to this one.
available_animations l r list A list containing all the animation names available to the object.
back i r px Returns the x position value. Duplicates front.
blue i rw 0-255 How strongly the blue color channel (of RGB) is drawn for the object.
clip_area l xywh A list containing x, y, width, and height for the rectangle inside which to draw the object. In level coordinates.
consts r A non-variable container. Set in an object's [vars] tag in it's .cfg file. Accessible via the dot operator, such as in vars.value.
cycle i r ticks The number of frames the object has existed. The game adds 50 cycles per second.
damage i rw hp Damage the object causes to other objects.
destroyed s r t/f Is the object destroyed? ?
distance_to_cliff i r px The distance from the object to a terrain drop-off.
down i r -1,1 Returns the value of upside-down.
driver o rw The object that is driving the current object. ?
facing s rw -1,1 An object can face either left or right.
fragment_shaders define OpenGL shaders and then have objects use those shaders when drawn ?
friction i r Values greater than zero will decay an object's velocity, whether standing, or in the air. ?
front i r px Returns the x position value. Duplicates back.
green i rw 0-255 How strongly the green color channel (of RGB) is drawn for the object.
group i The numeric group that the object is a member of; typically assigned in the editor. All members of a group activate/pause at once, the use of this is typically to make puzzles that require timing and are made from multiple objects, stay in sync.
hit_by s r name What object has collided with this object?
hitpoints i rw hp How much health remains for the object. A value of less than or equal to 0 causes death.
img_h i r pixels How high is the object's image?
img_mid_x i rw pixels Object midpoint, based on image.
img_mid_y i rw pixels See img_mid_x.
img_w i r pixels How wide is the object's image?
invincible s rw t/f Can be set to 'true' or 'false'. When true, the object does not take damage or react to a damaging event.
is_human s rw t/f Is the object controllable by a player? Having more than one is_human object causes Frogatto to start an internet multiplayer game.
is_standing s r t/f Is the object standing on anything?
is_standing_on_platform s r t/f If the object is standing on a moving platform, this is set to 'true'.
jumped_on_by s r name The name of the object that just landed on this one.
label s rw An identifying string. Can be set in the editor.
level r name The current level. See it's page for a description of the variables in it.
max_hitpoints i rw health How healthy can the object be, maximum?
me s r name I, me, myself. The current object.
midpoint_x i rw pixels The horizontal component of the centre of the object, in global coordinates.
midpoint_y i rw pixels The vertical component of the centre of the object, in global coordinates.
near_cliff_edge s r t/f Is the object near a cliff edge?
solid_mid_x i rw pixels Object midpoint, based on solidity data.
solid_mid_y i rw pixels See solid_mid_x.
red i rw 0-255 How strongly the red color channel (of RGB) is drawn for the object.
registry rw A permanent variable container. Values stored in here are saved across sessions and across save games. v
rotate f rw degrees Setting a value other than zero will rotate the object's sprite. This is purely cosmetic, nothing about the object's behavior or solidity is rotated for you. Rotate can be set to values outside 0-360 degrees, they wrap around using normal modulo arithmetic (e.g. 380° = 20°).
rotation_schedule l w list of ints When set, the object's rotation value will loop over this list, being set to each point. You can specify tweening between points by setting schedule_speed. This is used for repetitive motion, and is quite efficient. v
schedule_speed i w steps Controls how many frames to tween between each point set in x_schedule and y_schedule. v
shader s w OpenGL shader Specify an OpenGL shader to use. See this commit for an example. ?
slope_standing_on i r degrees The terrain slope the object is standing on, in degrees.
solid_rect l w px The area of an object that is it's sacred own. No other object can occupy this spot.
sound_volume i rw percentage How loud should the sound from this object be?
springiness i rw percentage How high things bounce off the current object.
standing_on o r Returns the name of the thing the current object is standing on.
stood_on s r t/f Is the object being stood on?
stood_on_by o r The name of the thing that is standing on the current object.
tags ?
time_in_animation i r ticks How many logic cycles the object has been in the current animation.
tmp rw A temporary variable container. Used to set internal vars for the current object. Use with the dot operator, as in set(tmp.variable, 10). These values are _not_ saved. v
traction i r 1000 = 100% How strongly an object is able to accelerate itself in the x direction (does not affect y) when its feet are touching ground. Internally, it reduces or increases accel_x proportionally; a value of 500 will reduce an object's acceleration by half. (Note: traction_in_air and traction_in_water could reasonably be replaced by boolean flags, since any objects that travel between mediums generally change their type upon entering a new medium, which could provide a different numerical value if necessary.)
traction_in_air i r 1000 = 100% Like traction, but affects an object regardless of whether its feet are touching the ground. Separate from traction, because fliers should always be able to propel themselves anywhere, but walkers should only be able to propel themselves on land. Not cumulative with traction.
traction_in_water i r 1000 = 100% Like traction, but affects an object only when underwater. Separate from traction_in_air because swimmers can propel themselves whilst their feet aren't touching the ground, but can only do so if underwater. Not cumulative with traction.
type s r 'Type' is what the object is. black_ant is a type, as is frogatto_playable. v
underwater s r t/f Returns true if the object is in water.
up i r -1,1 Returns the negative value of down, which returns the value of upside_down. ?
upside_down i rw -1,1 Objects flagged with this will automatically have their graphics vertically flipped; the person scripting the object is expected to query this value to change the physics. Because this value is just positive/negative, it's often directly useful in making that change, since multiplying vertical velocities (or quantities in general) by it correctly flips them.
variations l rw A list of modes for the object. Variations contain a series of "overrides" for existing animations and event handlers, and can be used to "as a group", change how the object looks, and how it acts, to different sets of behavior. This is used, for example, to make frogatto's powerups and fat state easy to switch between.
vars rw A variable container. Used to set internal vars for the current object. Use with the dot operator, as in set(vars.variable, 10). These values are saved.
velocity_x i rw centipixels/frame The horizontal velocity, a positive value being right and negative being left. ?
velocity_y i rw centipixels/frame The vertical velocity, a positive value being down and negative being up. ?
vertex_shaders Define OpenGL shaders and then have objects use those shaders when drawn. ?
x,y d rw pixels Level coordinates, in pixels. Note that each displayed pixel corresponds to four pixels of level coordinates (i.e. the coordinates have twice the resolution). v
x_schedule, y_schedule l w list of ints When set, the object's x or y position will loop over this list, being set to each point. You can specify tweening between points by setting schedule_speed. This is used for repetitive motion, and is very efficient. v
z or zorder i rw int Determines what order objects are drawn in; objects with a lower zorder are drawn behind objects with a higher zorder. Objects with equal zorders are sorted by their midpoint; those with a lower vertical midpoint are drawn in front of those with a higher midpoint. (Note: although it has always been this way, this behavior should be made configurable-per-level, because the opposite is desirable for platformer objects with a small amount of perspective. The current behavior is ideal for zelda-style overhead views.)
z_suborder i w int "second order z-sorting". Objects with equal zorders are normally sorted by their midpoint; this overrides that, and allows you to specify a draw order for objects within a given zorder. It works just like zorder in that higher values go in front, and lower values go behind. This is useless in the context of frogatto proper, but can be useful for mods in frogatto that pretend to have isometric 3d space, but don't actually simulate 3d height. An example of this is the current rpg mod, where it is used to hand-sort table decorations and such, where e.g. some unusual placements cause an object sitting on a table to be rendered behind the table. The reason this sorting is used is because we want to allow the same objects to be placed at (an illusion of) different heights; perhaps on the table, perhaps on the floor behind the table.

See UnstateAssumptions for more information.

Player-Specific Properties:

The played is defined by is_human=true.

can_interact i r boolean Returns true(1) if the player can interact with an object. For example, on an iPhone, this is the check for the context interact button appearing. v
difficulty i r level Difficulty level of the game. Starts at one. v
ctrl_keys l r mixed When the user presses any key on the keyboard, as long as it is pressed it will appear in this list. (Note, of course, that most keyboards cheaped out on the detection circuits and will only register three to five simultaneous key presses.) If a character is alphanumeric, it is returned as a string. However, if it is a non-printable character, it is returned as an integer value. t
ctrl_mice l r Returns a list of lists. Each sub-list lists a mouse state as [x,y,button(,s)]. If more than one mouse button is pressed, then there is more than one button in the list. Generally, you would check for value in ctrl_mice[0] on a computer, but multi-touch systems will return several mice instead of just the zeroth mouse. value can be 'left', 'right', 'middle', 'x1', or 'x2'. x and y are window coordinates, the upper left corner always being 0,0. (See level.camera_position for the offset value.) t
is_standing_on_platform i r boolean True(1) for any platform frogatto can down-jump from. This is the property that is checked for when drawing the down-jump button on iOS. t
underwater_controls i r boolean Returns true(1) if the player is underwater and needs different controls. For example, on an iPhone, this is the check for the swim buttons appearing. v

Clone this wiki locally