-
Example: Rotating a Sequence Item
You can create a Sequence for a sword animation, and play it in-game. But, the animating sword cannot be easily rotated with the player.
Read more... -
How to use surfaces?
A Surface is a rectangular canvas where something can be drawn. Everything in that surface will not be drawn to the screen until you draw it yourself.
Read more... -
How to pause a game?
The simplest way to pause a game, is to deactivate all instances, except for the main controller object (which handles pausing & unpausing).
Read more... -
How to draw a paused game?
You can pause your game now, but you can’t see your deactivated instances. To make this work, you can make use of Surfaces.
Read more... -
How to create particles?
To create particles with GML, you need (1) a Particle System, and (2) a Particle Type.
Read more... -
How to clear the asset cache?
You might be getting weird graphical glitches, especially on the HTML5 platform. Clearing the asset compiler cache may sometimes fix these issues.
Read more... -
How to use scripts? (2.2.5)
Scripts allow you to create custom functions. You can call your script function, pass in arguments, run some code in it, and expect a result; just like a regular built-in function.
Read more... -
How to change the color of a sprite?
The color of an instance can be changed with
image_blend
.Read more... -
How to handle tile collisions?
Tile collisions only allow the first tile in a tileset to be the “empty” tile:
Read more... -
How to do depth-ordering?
To make sure that objects are drawn in the correct order, when making a top view game, you can use the
depth
variable.Read more... -
How to handle object collisions?
To enable collisions in a moving object, you can do this:
- Set the movement speed (usually
hsp
andvsp
) - Check if there are collisions where you’re moving (separately on
x
andy
) - If a collision is found on either dimension, you set that dimension’s speed to 0
- Before setting it to 0, you run a
while
loop to close any gap between the two colliding instances
- Before setting it to 0, you run a
Read more... - Set the movement speed (usually
-
How to handle collisions?
Take a look at these pages:
Read more... -
How to do sprite animations?
Simple sprite animation in an object can be done by changing the
sprite_index
when appropriate.Read more... -
How to animate an object?
Take a look at these pages:
Read more... -
How to draw an inventory?
Assuming your inventory is a DS List, and your items are in an Enum, you can store the sprite of each item in an array:
Read more... -
How to jump in a top-down game?
Jumping in a top-down game is tricker. You’re already using up the X and Y axes for 4-directional movement, so for jumping, you now need a third axis: Z.
Read more... -
How to flip an instance/sprite?
Whether you’re making a platformer or a top-down game, you want your instances to flip, depending on where they’re facing on the X-axis: that is, either left or right.
Read more...
Questions