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.

• Make sure you delete resources you no longer need. Otherwise the system soon runs<br />

out of memory.<br />

In general, you should not change any resources during game play. Better create and change<br />

the resources at the beginning of the game or maybe at the beginning of a room.<br />

Sprites<br />

The following routines are available for changing sprite properties:<br />

sprite_set_offset(ind,xoff,yoff) Sets the offset of the sprite <strong>with</strong> the<br />

given index.<br />

sprite_set_bbox_mode(ind,mode) Sets the bounding box mode of the<br />

sprite (0=automatic, 1=full image, 2=manual).<br />

sprite_set_bbox(ind,left,top,right,bottom) Sets the bounding box<br />

of the sprite <strong>with</strong> the given index. Works only when the bounding box mode is<br />

manual.<br />

sprite_set_precise(ind,mode) Sets whether the sprite <strong>with</strong> the given<br />

index uses precise collision checking (true or false).<br />

The following routines can be used to create new sprites and to remove them.<br />

sprite_duplicate(ind) Creates a duplicate of the sprite <strong>with</strong> the given<br />

index. It returns the index of the new sprite. When an error occurs -1 is<br />

returned.<br />

sprite_assign(ind,spr) Assigns the indicated sprite to sprite ind. So this<br />

makes a copy of the sprite. In this way you can easily set an existing sprite to<br />

a different, e.g. new sprite.<br />

sprite_merge(ind1,ind2) Merges the images from sprite ind2 into sprite<br />

ind1, adding them at the end. If the sizes don't match the sprites are<br />

stretched to fit. Sprite ind2 is not deleted!<br />

sprite_add(fname,imgnumb,precise,transparent,smooth,preload<br />

,xorig,yorig) Adds the image stored in the file fname to the set of sprite<br />

resources. Many different image file types can be dealt <strong>with</strong>. When the image<br />

is not a gif image it can be a strip containing a number of subimages for the<br />

sprite next to each other. Use imgnumb to indicate their number (1 for a<br />

single image). For (animated) gif images, this argument is not used; the

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

Saved successfully!

Ooh no, something went wrong!