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 cover most use cases... I think. 


## FEATURES:

  • add Hurtable behavior by parenting or attach Hurt Boxes to instances. 
  • adjust how Hurt Boxes follow / mimic their 'owning' instances.
  • create Hit Boxes with hitbox_create() function.
  • adjust how Hit Boxes follow / mimic their 'owning' 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:

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


## BEHIND THE HOOD:

HitLib relies on Hit Boxes, 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.  

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 to only have one controller.


## 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 melee attack when your instance is moving).  

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 specify a detroy your condition for your Hit Boxes (the best approach is to call set_destroy_on_end or set_destroy_timer) or to destroy Hit Box manually. 


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.