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.

Particle motion<br />

Particles can move during their lifetime. They can get an initial speed (or range of speeds) and<br />

direction, and the speed and direction can change over time. Also gravity can be defined that<br />

pulls the particles in a particular direction. The following functions exist for this:<br />

part_type_speed(ind,speed_min,speed_max,speed_incr,speed_wi<br />

ggle) Sets the speed properties for the particle type. (Default all values are<br />

0.) You specify a minimal and maximal speed. A random value between the<br />

given bounds is chosen when the particle is created. You can indicate a speed<br />

increase in each step Use a negative number to slow the particle down (the<br />

speed will never become smaller than 0). Finally you can indicate some<br />

amount of wiggling of the speed.<br />

part_type_direction(ind,dir_min,dir_max,dir_incr,dir_wiggle<br />

) Sets the direction properties for the particle type. (Default all values are 0.)<br />

Again you specify a range of directions (in counterclockwise degrees; 0<br />

indicated a motion to the right). For example, to let the particle move in a<br />

random direction choose 0 and 360 as values. You can specify an increase in<br />

direction for each step, and an amount of wiggling.<br />

part_type_gravity(ind,grav_amount,grav_dir) Sets the gravity<br />

properties for the particle type. (Default there is no gravity.) You specify the<br />

amount of gravity to be added in each step and the direction. E.g. use 270 for<br />

a downwards direction.<br />

Particle systems<br />

Particles live in particle systems. So to have particles in your game you need to create one or<br />

more particle systems. There can be different particle systems (but preferably keep their<br />

number small). For example, if your game has a number of balls and each ball should have a<br />

tail of particles, most likely each ball has its own particle system. The easiest way to deal <strong>with</strong><br />

particle systems is to create one and then create particles in it, using the particle types you<br />

specified before. But, as we will see below, particle systems can contain emitters that<br />

automatically produce particles, attractors that attract them, and destroyers that destroy<br />

them.<br />

Once particles are added to a particle system they are automatically updated each step and<br />

drawn. No further action is required. To make it possible that particles are drawn, behind, in

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

Saved successfully!

Ooh no, something went wrong!