1 = Object Class Reference =
4 _Italics_ means private (in the sense that they shouldn't be set manually).
7 `------------`--------------------
9 ----------------------------------
10 x x position (on screen)
11 y y position (on screen)
14 x_offset drawing offset
15 y_offset drawing offset
16 angle movement heading in degrees
17 speed speed (in pixels/update)
18 image image of the Object
19 rects list of collision Rects
20 type type of Object (for collision)
21 max_updates maximum number of updates before Object self collects
22 _num_updates_ current number of updates
23 _death_anim_ flag for if Object is in death animation (affects collision)
24 _collect_ flag to indicate if an Object should be collected
25 ----------------------------------
29 `----------------------`--------------------
31 --------------------------------------------
33 update() updates the Object's state
34 draw() draws the Object's image at (x, y)
35 collide(ids, object) method executed upon collision (undefined for base class)
36 get_center() returns the center coordinates of the Object
37 set_origin() sets the drawing offset (sprite is offset by these amounts to the upper left)
38 --------------------------------------------
41 This class is not designed to be instantiated directly, instead it should be
42 extended and serve as the base for all in-game objects.
43 An example object definition is as follows:
46 source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 MyObj.attr2 = "some value"
54 setmetatable(o, self)
\r
59 --other methods defined here
60 source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~