A downloadable asset pack

# Hit Boxes Library

A silhouette kicking a target

Manage Hit Boxes and Hurt Boxes.

## WELCOME!

HitLib is a library I have built over 2 projects to process hiting/hurting enemies or other entities called 'hurtable'. The library comes with many options and is quite ok... I think. HitLib is a library I have built over 2 projects to process hiting/hurting enemies or other entities called 'hurtable'. The library comes with many options and is quite ok... I think.


## FEATURES:

  • add Hurtable behavior by parenting or attach Hurt Boxes to instances. 
  • adjust how Hurt Bowes follow / mimic their 'owning' instances.
  • create Hit Boxes with hitbox_create() function.
  • adjust how Hit Bowes follow / mimic their 'owninh' instance.
  • add speed to Hit Boxes, manage high speed movement collision. 
  • cancel Hit Boxes on collision with walls.
  • Customize parameters (damages, attack types, callback function...) to fit your game features.


## LICENSE:

G2L is fully free. Do whatever you want with it.


## BEHIND THE HOOD:

Hitlib relies on hitboxes, virtual sprite-shaped entities that deal damages upon collision with hurtable instances.  

Hit Boxes are struct entities. They are managed by 'controller' objects called Hitbox_manager.  

Note that the same result could be achieved with independant objects.  

Hitbox_manager objects are mainly there for processing collision and drawing the associated sprites (thus, there is one Hitbox_manager per layer, no matter the number of Hitboxes). If you make your Hit Boxes invisible, you should create all of them at the same depth.  

Hurt Boxes are instances of the oHurtbox


## USAGE:

There is no intialization function required. You can create Hit Boxes with hitbox_create() and then they are processed automatically.  

For example, 

hitbox_create(x, y, sprite_slash)
will create an Hit Box that follows the calling instance (useful for a slash).  

hurtbox_create(sBig_Square)
will create an Hit Box that follows the calling instance and its angle/scales. It collision mask is set to sBig_Square mask.

You need to manually  detroy your Hit Boxes. The best approach is to set destroy_on_end or a destroy_timer, but this might not be convenient for projectiles.


Enjoy ! (I hope)

StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorMichelV

Download

Download
Hit Boxes Package.yymps 26 kB
Download
Hit Boxes Demo.yymps 200 kB

Install instructions

## HOW TO INSTALL IN GAME MAKER YOUR PROJECT

Download the 'Hit Boxes Package.yymps' file. (the other package is a simple demo if you want to try it out).  

Import it inside your project. You can do this by dragging the . yymps file from an explorer window onto the GameMaker IDE or by clicking "Import Local Package" within the Tools Menu. In both case, a window will pop up to define import parameters.  

Click “add all” and “OK”.  

This will create one folder in your Asset Browser labeled “Hitbox BY MICHELV”. The code is ready to be used.  

## HOW TO USE:

There are two macro you need to set to interface 'HitBoxes' with your code.

They are located in the 'hitboxlib.gml' script asset under the section 'HitLib Options'.

- #macro __HITLIB_DEFAULT_COLLIDER  oColliderTest: the name of a Collider / Solid Parent Object. Children will bloc Hit Boxes.

- #macro __HITBOX_DEFAULT_HURTABLE  [oTarget_Par, oHurtbox]: the names of all 'Hurtable' Parent Objects. All their children will gain the ability to be hurt by Hit Boxes.

Leave a comment

Log in with itch.io to leave a comment.