Information and Contacts

Latest News

This section of the V4T Project portal provides administrative information for the project contractual partners and for the European Commission and it is password protected.



Table of Contents
2.2 Game Maker
2.2.6 Animation and advanced collisions

Animation in games is crucial for a good in-game experience and immersion. Since the beginning of videogames, programmers and artists have worked hard to produce the most realistic and appealing look in games. This requires to replicate the movements that many objects have in real life. For example, driving a car from upside or behind should not only result in watching the car moving along a road, but to see the wheels turning, the smoke coming out from the exhaust, the car itself bumping or the road shaking the tyres. There are several techniques to generate animation effects in games, some of which are nicely integrated in Game Maker. Images also deal with the physical representation of objects that frequently move and collide with other objects.

The most extended technique to get animations, comes from using a set of similar images that are displayed cyclically. If the rate at which the images change is the right one, the player will perceive the images as an animation. The difficult task that remains is to draw a set of images that produce the best animation possible

We consider the sprite to have several sub-images. Take for example que following "strip" of images. The sprite would show one girl at a time switching to the next in row quickly, giving the effect that the girl actually walks by moving her legs  (the image would change together with the position).

 

https://opengameart.org/content/girl-walking-side

Game maker is very powerful when it comes to create and use sprites. It can read a file like the above and "split" it into different sub-images quite easily, thus creating the sprite almost automatically. It can handle images whose sub-images are aligned in other layouts (for example in a matrix)

Using sprites in Game maker is fairly easy, very powerful and gives good results. But drawing or creating the sprites is another story. To begin creating games, there are lots of free sprites sets in some websites (see Online resources below). 

 Sprites also set the object shape and depending on the size of the object relative to the room, it may be unacceptable to manage the collisions between objects just relaying on the coordinates of objects. For example, Consider on small object moving objects moving towards a big one. Most of the times,  the collision detection must prevent objects from overlapping or penetrate one into the other. Therefore, the collision system can not only take into account the positions of objects, but also the shape and dimensions.

When defining a sprite, it is also useful and straightforward to set the "collision mask" of the sprite, which will apply to objects displaying the sprite. The collision mask is an area of a potentially arbitrary form. Typically, for performance reasons, the collision mask is a rectangle, that can be rotated if necessary to better match the sprite shape. Circles and ellipses can also be set as collision mask, but they are slower to compute. Finally, in very particular cases, the collision mask can be set to that of the shape of all sub-images of sprite combined. This is by far, slower. Bear in mind that collisions have to be checked 60 times per second for every two objects being close

In Game maker, simple collisions are handled by the developer in two ways:

  • Using the collision event for which the developer can write the action code that will take care of what to do. This is the preferred way when collisions are not usual for an object (for example a space ship travelling through the space)
  • Checking potentially collisions on actions linked to the step event. This is recommendable if an object is usually colliding with another. Not using the collision event will save some time because the same can be achieved from the step event by checking explicitly from the code.

Game Maker includes a physics game engine, that open up a totally new way of handling the movements, collisions, and physical interaction between objects. When this feature is used, collisions are totally managed by the game engine, greatly simplifying the development. The drawback is that the developer has to specify physical properties for every object and room, and probably fine-tune some parameters to get the desired result.


Online Resource

Sprites - Website providing access to a repository of Sprites




This project has been funded with support from the European Commission. This web site reflects the views only of the author, and the Commission cannot be held responsible for any use which may be made of the information contained therein.

The V4T - Videogames 4 Teachers project © 2018