Sons of Camelot: Collision Mask

Collision mask

collision mask is a graphic that represents the "sensitive" area of an object (a player, an enemy, a wall, a door). The mask doesn't need to be as the sprite of the object, in fact it's better not to be same (reason below).

Mask is used to detect when 2 objects hit, i.e. player is hit by a bullet, or maybe player hits a wall.

By default GM uses bigger rectangular shape that contains sprite, that means mask could be really big if sprite has irregular shape, also lot of computer power waste, much better to use simple shape as rectangle or ellipse to avoid any problem related to irregular shape of sprite.

I.e. for this skeleton sprite

this is GM automatic collision mask (in dark grey):

Player Mask

We will use a manual mask, rectangular shape, from head to knee in example.

For each object's sprite, for running, walking,etc we will follow above recomendations, changing maybe mask position but not mask size.

Only exception from my game will be roll sprite, it will be only 1 single pixel  at the character's feet. That way when rolling player is almost invulnerable and then player won't be stuck in a wall.

If we use different masks for different player conditions (running, idle, hurt, roll, etc) could change player condition just when player is i.e. near a wall, then is mask change to a bigger one, player will be stuck there.

Other masks: Enemies and Furniture

Automatic mask. But take care about we will discuss next.

When NOT use automatic mask

We have this kind of sprite (Big skeleton):

By default collision mask is a big rectangle, that means transparent parts are also included, then if player hits transparent parts is hurting skeleton. 

To avoid this, I changed mask shape to ellipse:

Player: Power Ups

Player by default has a basic fire, can upgrade by getting power ups, just for limited time.

We will follow original game strategy:
  • Basic fire: slow fire, hits 1 life. 
  • Upgrade fire: fast fire, hits 3 life each time. Lasts around 10 seconds.