Difference between revisions of "MPUZ: Functions"

From Mario Fan Games Galaxy Wiki
m
m
 
Line 3: Line 3:
  
 
== Keywords and Global Variables ==
 
== Keywords and Global Variables ==
*'''me''': the reference to the object currently having its script executed. For example, an object may use ''me.x'' within its script to retrieve its x position. For a breakdown of the variables contained in the object structure, check out [[MPUZ: Object Variables]].  
+
===Object references===
*'''id''': the current object's ''sysid''; in fact, this variable is exactly the same as using ''me.sysid''.
+
''For a breakdown of the variables contained in the object structure, check out [[MPUZ: Object Variables]].''
*'''pi''': i was nice enough to provide this so you could save the effort of typing ''math.pi''.
+
*'''me''': the reference to the object currently having its script executed. For example, an object may use ''me.x'' within its script to retrieve its x position.  
*'''eps''': 'epsilon', basically a small number which is used to make floating-point comparisons a little more reliable. Basically, instead of doing ''x == y'', you'll do ''abs(x - y) < eps''. By default, it's '''.0001''' (or close enough to). However, you should  avoid floating-point comparisons whenever possible.
+
*'''other''': the reference to the other object involved in an event, usually collisions. Note that this variable becomes valid only in certain cases.
*'''fps''': returns the current fps.
+
*'''player''': refers to the player object.
*'''basefps''': returns the 'ideal' fps, which is set in the game options.  
+
*'''selected''': a special reference that actually references more than one object. It performs a given action to each of its instances individually. Like '''other''', it is only valid in certain cases; namely only after using '''select()''', and becomes invalid at the end of the calling object's event.
*'''timer''': the in-game clock, if it is being used in the level; if it isn't, it's '''false'''. Counts down by one approximately every real second.
 
*'''timertick''': increments by 1 each time the main loop finishes, and wraps around back to 0 when it equals '''fps'''; at that point, it decrements '''timer''' by 1.
 
*'''counter''': incremented by 1 each time the main loop finishes; ie. it's tied to the framerate. It does not wrap at a certain point, but continues counting.
 
 
== Functions ==
 
== Functions ==
 
=== Game ===
 
=== Game ===

Latest revision as of 01:49, 15 May 2009

This information is subject to change.
MPUZ
Mpuz logo.png
Development Main Page
Basics
Intermediate
Advanced
  • none
Reference
[Edit]


The following is a list of functions and keywords used by MPUZ's engine.

Keywords and Global Variables

Object references

For a breakdown of the variables contained in the object structure, check out MPUZ: Object Variables.

  • me: the reference to the object currently having its script executed. For example, an object may use me.x within its script to retrieve its x position.
  • other: the reference to the other object involved in an event, usually collisions. Note that this variable becomes valid only in certain cases.
  • player: refers to the player object.
  • selected: a special reference that actually references more than one object. It performs a given action to each of its instances individually. Like other, it is only valid in certain cases; namely only after using select(), and becomes invalid at the end of the calling object's event.

Functions

Game

Level

Object

HUD

to be expanded