-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Gamemaker Essentials
When it comes to making games with animation, it is extremely common for the animation to need to stop or change when an event happens. For example, the player pressing the right arrow key may make the game change the character's animation to a running animation.
You will learn to do this through programming using GameMaker Language in a new object.
Every object in GameMaker has a set of variables that allow users to control what sprite an object has linked to it, as well as the animation speed, current frame, and more.
The
sprite_index variable defines which sprite the object currently has set to it. Changing this variable will change the object's sprite.
The following is the example code:
sprite_index=spr_player;
The sprite_width and sprite_height variables return the width and height of the sprite currently linked to an object. This becomes useful when positioning text or other things around...
Change the font size
Change margin width
Change background colour