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.

different types of images can be dealt <strong>with</strong>. transparent indicates whether<br />

the image is partially transparent. smooth indicates whether to smooth the<br />

edges. preload indicates whether to preload the image into texture memory.<br />

The function returns the index of the new background that you can then use to<br />

draw it or to assign it to the variable background_index[0] to make it visible in<br />

the current room. When an error occurs -1 is returned.<br />

background_add_alpha(fname,preload) Adds the image stored in the<br />

file fname to the set of background resources, but this time the file has an<br />

alpha channel to indicate transparency (as for example in .png files). The<br />

arguments are the same as above (but two are missing as they are not<br />

relevant in this case). When an error occurs -1 is returned.<br />

background_replace(ind,fname,transparent,smooth,preload)<br />

Same as above but in this case the background <strong>with</strong> index ind is replaced. The<br />

function returns whether it is successful. When the background is currently<br />

visible in the room it wil be replaced also.<br />

background_replace_alpha(ind,fname,preload) Same as above but in<br />

this case the file has an alpha channel.<br />

background_create_color(w,h,col,preload) Creates a background of<br />

the given size and <strong>with</strong> the given color. It returns the index of the new<br />

background. When an error occurs -1 is returned.<br />

background_create_gradient(w,h,col1,col2,kind,preload)<br />

Creates a gradient filled background of the given size. col1 and col2 indicate<br />

the two colors. kind is a number between 0 and 5 indicating the kind of<br />

gradient: 0=horizontal 1=vertical, 2= rectangle, 3=ellipse, 4=double<br />

horizontal, 5=double vertical. It returns the index of the new background.<br />

When an error occurs -1 is returned.<br />

background_create_from_screen(x,y,w,h,transparent,smooth,pr<br />

eload) Creates a background by copying the given area from the screen. This<br />

makes it possible to create any background you want. Draw the image on the<br />

screen using the drawing functions and next create a background from it. (If<br />

you don't do this in the drawing event you can even do it in such a way that it<br />

is not visible on the screen by not refreshing the screen.) The other<br />

parameters are as above. The function returns the index of the new<br />

background. A work of caution is required here. Even though we speak about<br />

the screen, it is actually the drawing region that matters. The fact that there is<br />

a window on the screen and that the image might be scaled in this window

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

Saved successfully!

Ooh no, something went wrong!