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.

When a ball hits the floor it must change direction. This has to be specified in the collision<br />

event of the ball <strong>with</strong> the floor. Because there are four different floors we need to put the code<br />

on four different collision events of the ball. But when you make one base floor object and<br />

make this one the parent of the four actual floor objects, you only need to specify the collision<br />

event <strong>with</strong> this base floor. The other collisions will perform the same event. Again, this saves a<br />

lot of copying.<br />

As indicated, wherever you use an object, this also implies the descendants. This happens<br />

when, in an action, you indicate that the action must be applied to instances of a certain<br />

object. It also happens when you use the <strong>with</strong>() statement in code (see below). And it works<br />

when you call functions like instance_position, instance_number, etc. Finally, it works<br />

when you refer to variables in other objects. In the example above when you set ball1.speed<br />

to 10 this also applies to ball2, ball3 and ball4.<br />

Masks<br />

When two instances collide a collision event occurs. To decide whether two instances intersect,<br />

the sprites are used. This is fine in most cases, but sometimes you want to base collisions on a<br />

different shape. For example, if you make an isometric game, objects typically have a height<br />

(to give them a 3D view). But for collisions you only want to use the ground part of the sprite.<br />

This can be achieved by creating a separate sprite that is used as collision mask for the object.<br />

Information<br />

The button Show Information gives an overview of all information for the object that can<br />

also be printed. This is particularly useful when you loose overview of all your actions and<br />

events.<br />

More actions<br />

In advanced mode there are a number of additional actions available which will be described<br />

here.<br />

More move actions

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

Saved successfully!

Ooh no, something went wrong!