Game Development Reference
In-Depth Information
image_blend is a color applied to the sprite when it is drawn. It is set to c_white by
default, and using different values will change the color of the sprite when it is drawn.
You can only change this variable in the registered, Pro version of Game Maker 8.
visible determines whether the object is visible or invisible ( true or false ).
solid determines whether the object is treated as solid in collisions ( true or false ).
persistent determines whether the object will continue to exist in the next room, or
whether it remains part of the room in which it was originally created ( true or false ).
Note The constants true and false correspond to the values 1 and 0 , respectively.
These two variables hold information about the identity of the instance:
id is a unique identifying number that distinguishes the current instance from any
other.
object_index is the index of the object resource that the current instance is an
instance of.
There are also a number of other variables that you cannot change, but are maintained
internally by Game Maker for each instance depending on the current sprite. So you can check to
see what values these variables hold (using a Test Variable action, for example), but you cannot
change them (using a Set Variable action):
sprite_width is the width of the current sprite displayed for the instance.
sprite_height is the height of the current sprite displayed for the instance.
sprite_xoffset is the x position of the origin within the sprite.
sprite_yoffset is the y position of the origin within the sprite.
image_number is the number of images in the current sprite.
bbox_left is the x coordinate of the left edge of the sprite's bounding box in the room.
bbox_right is the x coordinate of the right edge of the sprite's bounding box in the
room.
bbox_top is the y coordinate of the top edge of the sprite's bounding box in the room.
bbox_bottom is the y coordinate of the bottom edge of the sprite's bounding box in the
room.
Variables in Other Instances
You usually refer to an instance's variables within its own actions by entering their names in their
basic form, as provided previously. Using actions to set or test an instance's variables in this way
will only affect the instance concerned (hence, they are local to the instance). However, you can
also refer to variables in other instances by using an object name followed by a dot (period/full-
stop) and then the variable name (for example, obj_dragon.x ). Used within a Test Variable action,
this would retrieve the x position of the first instance of obj_dragon that was placed in the room
(disregarding any other instances of obj_dragon ). However, used within a Set Variable action, it
would change the x position of all the instances of obj_dragon in the game—so be careful.
 
Search WWH ::




Custom Search