08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

image_index When the image has multiple subimages the program cycles<br />

through them. This variable indicates the currently drawn subimage (they are<br />

numbered starting from 0). You can change the current image by changing<br />

this variable. The program will continue cycling, starting at this new index.<br />

(The value can have a fractional part. In this case it is always rounded down to<br />

obtain the subimage that is drawn.)<br />

image_speed The speed <strong>with</strong> which we cycle through the subimages. A value<br />

of 1 indicates that each step we get the next image. Smaller values will switch<br />

subimages slower, drawing each subimage multiple times. Larger values will<br />

skip subimages to make the motion faster. Sometimes you want a particular<br />

subimage to be visible and don't want the program to cycle through all of<br />

them. This can be achieved by setting the speed to 0 and choosing the correct<br />

subimage. For example, assume you have an object that can rotate and you<br />

create a sprite that has subimages for a number of orientations (counter-<br />

clockwise). Then, in the step event of the object you can set<br />

{<br />

image_index = direction * image_number/360;<br />

image_speed = 0;<br />

}<br />

depth Normally images are drawn in the order in which the instances are<br />

created. You can change this by setting the image depth. The default value is<br />

0, unless you set it to a different value in the object properties. The higher the<br />

value the further the instance is away. (You can also use negative values.)<br />

Instances <strong>with</strong> higher depth will lie behind instances <strong>with</strong> a lower depth.<br />

Setting the depth will guarantee that the instances are drawn in the order you<br />

want (e.g. the plane in front of the cloud). Background instances should have<br />

a high (positive) depth, and foreground instances should have a low (negative)<br />

depth.<br />

image_xscale A scale factor to make larger or smaller images. A value of 1<br />

indicates the normal size. You must separately set the horizontal xscale and<br />

vertical yscale. Changing the scale also changes the values for the image<br />

width and height and influences collision events as you might expect.<br />

Changing the scale can be used to get a 3-D effect. You can use a value of -1<br />

to mirror the sprite horizontally.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!