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.

speed Its current speed (pixels per step).<br />

friction Current friction (pixels per step).<br />

gravity Current amount of gravity (pixels per step).<br />

gravity_direction Direction of gravity (270 is downwards).<br />

motion_set(dir,speed) Sets the motion <strong>with</strong> the given speed in direction<br />

dir.<br />

motion_add(dir,speed) Adds the motion to the current motion (as a<br />

vector addition).<br />

There are a large number of functions available that help you in defining your motions:<br />

place_free(x,y) Returns whether the instance placed at position(x,y) is<br />

collision-free. This is typically used as a check before actually moving to the<br />

new position.<br />

place_empty(x,y) Returns whether the instance placed at position (x,y)<br />

meets nobody. So this function takes also non-solid instances into account.<br />

place_meeting(x,y,obj) Returns whether the instance placed at position<br />

(x,y) meets obj. obj can be an object in which case the function returns true is<br />

some instance of that object is met. It can also be an instance id, the special<br />

word all meaning an instance of any object, or the special word other.<br />

place_snapped(hsnap,vsnap) Returns whether the instance is aligned<br />

<strong>with</strong> the snapping values.<br />

move_random(hsnap,vsnap) Moves the instance to a free random, snapped<br />

position, like the corresponding action.<br />

move_snap(hsnap,vsnap) Snaps the instance, like the corresponding<br />

action.<br />

move_wrap(hor,vert,margin) Wraps the instance when it has left the<br />

room to the other side. hor indicates whether to wrap horizontaly and vert<br />

indicates whether to wrap vertically. margin indicates how far the origin of<br />

the instance must be outside the room before the wrap happens. So it is a<br />

margin around the room. You typically use this function in the Outside event.<br />

move_towards_point(x,y,sp) Moves the instances <strong>with</strong> speed sp toward<br />

position (x,y).<br />

move_bounce_solid(adv) Bounces against solid instances, like the<br />

corresponding action. adv indicates whether to use advance bounce, that also<br />

takes slanted walls into account.

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

Saved successfully!

Ooh no, something went wrong!