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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sprite_add_from_surface(ind,id,x,y,w,h) Adds an area of the<br />

surface id as a next subimage to the sprite <strong>with</strong> index ind.<br />

sprite_delete(ind) Deletes the sprite from memory, freeing the memory<br />

used.<br />

The following routine exists to change the appearance of a sprite.<br />

Sounds<br />

sprite_set_alpha_from_sprite(ind,spr) Changes the alpha<br />

(transparancy) values in the sprite <strong>with</strong> index ind using the intensity values in<br />

the sprite spr. This cannot be undone.<br />

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

sound_add(fname,kind,preload) Adds a sound resource to the game.<br />

fname is the name of the sound file. kind indicates the kind of sound<br />

(0=normal, 1=background, 2=3d, 3=mmplayer) preload indicates whether the<br />

sound should immediately be stored in audio memory (true or false). The<br />

function returns the index of the new sound, which can be used to play the<br />

sound. (-1 if an error occurred, e.g. the file does not exist).<br />

sound_replace(index,fname,kind,preload) Same as the previous<br />

function but this time a new sound is not created but the existing sound index<br />

is replaced, freeing the old sound. Returns whether correct.<br />

sound_delete(index) Deletes the indicated sound, freeing all memory<br />

associated <strong>with</strong> it. It can no longer be restored.<br />

Backgrounds<br />

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

background_duplicate(ind) Creates a duplicate of the background <strong>with</strong><br />

the given index. It returns the index of the new background. When an error<br />

occurs -1 is returned.<br />

background_assign(ind,back) Assigns the indicated background to<br />

background ind. So this makes a copy of the background.<br />

background_add(fname,transparent,smooth,preload) Adds the<br />

image stored in the file fname to the set of background resources. Many

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

Saved successfully!

Ooh no, something went wrong!