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.

particle type the changer must changed into what other type.<br />

part_changer_kind(ps,ind,kind) Sets the kind for the changer.<br />

Firework Example<br />

Here is an example of a particle system that creates fireworks. The firework uses two particle<br />

types: one that forms the rocket and one that forms the actual fireworks. The rocket<br />

generates the firework particles when it dies. We also generate one emitter in the particle<br />

system that regularly stream out rocket particles along the bottom of the screen. To make this<br />

work you need an object. In its creation event we place the following code that creates the<br />

particle types, particle system, and the emitter:<br />

{<br />

// make the particle system<br />

ps = part_system_create();<br />

// the firework particles<br />

pt1 = part_type_create();<br />

part_type_shape(pt1,pt_shape_flare);<br />

part_type_size(pt1,0.1,0.2,0,0);<br />

part_type_speed(pt1,0.5,4,0,0);<br />

part_type_direction(pt1,0,360,0,0);<br />

part_type_color1(pt1,c_red);<br />

part_type_alpha2(pt1,1,0.4);<br />

part_type_life(pt1,20,30);<br />

part_type_gravity(pt1,0.2,270);<br />

// the rocket<br />

pt2 = part_type_create();<br />

part_type_shape(pt2,pt_shape_sphere);<br />

part_type_size(pt2,0.2,0.2,0,0);<br />

part_type_speed(pt2,10,14,0,0);<br />

part_type_direction(pt2,80,100,0,0);<br />

part_type_color2(pt2,c_white,c_gray);<br />

part_type_life(pt2,30,60);

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

Saved successfully!

Ooh no, something went wrong!