Designing Games with Game Maker - YoYo Games
Designing Games with Game Maker - YoYo Games
Designing Games with Game Maker - YoYo Games
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
number of images in the gif file is used. precise indicates whether precise<br />
collision checking should be used. transparent indicates whether the image<br />
is partially transparent. smooth indicates whether to smooth the edges.<br />
preload indicates whether to preload the image into texture memory. xorig<br />
and yorig indicate the position of the origin in the sprite. The function returns<br />
the index of the new sprite that you can then use to draw it or to assign it to<br />
the variable sprite_index of an instance. When an error occurs -1 is returned.<br />
sprite_add_alpha(fname,imgnumb,precise,preload,xorig,yorig)<br />
Adds the image stored in the file fname to the set of sprite resources, but this<br />
time the file has an alpha channel to indicate transparency (as for example in<br />
.png files). The arguments are the same as above (but two are missing as<br />
they are not relevant in this case). When an error occurs -1 is returned.<br />
sprite_replace(ind,fname,imgnumb,precise,transparent,smooth<br />
,preload,xorig,yorig) Same as above but in this case the sprite <strong>with</strong><br />
index ind is replaced. The function returns whether it is successful.<br />
sprite_replace_alpha(ind,fname,imgnumb,precise,preload,xori<br />
g,yorig) Same as above but in this case the file has an alpha channel. The<br />
function returns whether it is successful.<br />
sprite_create_from_screen(x,y,w,h,precise,transparent,smoot<br />
h,preload,xorig,yorig) Creates a sprite by copying the given area from<br />
the screen. This makes it possible to create any sprite you want. Draw the<br />
image on the screen using the drawing functions and next create a sprite from<br />
it. (If you don't do this in the drawing event you can even do it in such a way<br />
that it 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 sprite. A<br />
work of caution is required here. Even though we speak about the screen, it is<br />
actually the drawing region that matters. The fact that there is a window on<br />
the screen and that the image might be scaled in this window does not matter.<br />
sprite_add_from_screen(ind,x,y,w,h) Adds an area of the screen as a<br />
next subimage to the sprite <strong>with</strong> index ind.<br />
sprite_create_from_surface(id,x,y,w,h,precise,transparent,s<br />
mooth,preload,xorig,yorig) Creates a sprite by copying the given area<br />
from the surface <strong>with</strong> the given id. This makes it possible to create any sprite<br />
you want. Draw the image on the surface using the drawing functions and next<br />
create a sprite from it. The function returns the index of the new sprite. Note<br />
that alpha values are maintained in the sprite.