55 HrpgCollider - JcerelusDev/CanvasGameJs GitHub Wiki

What is HrpgCollider ?

HrpgCollider has its name already described it , it is a collision detector that use in rpg tiled map based game.

It's job is to detect and at the same time respond for collision in horizontal axis or x axis.

How to use it ?

In your update function after moving the character and using the method setCollider , you need to use (HrpgCollider).

It has two parameters :

1.- layername

2.- the object it can be player or enemies or npcs .

	    	    player.oldY = player.y;
		    player.oldX = player.x;
		
		   
		    controlPlayer()
		    game.setCollider(player,false)
		     VrpgCollider("collision",player)
		
		
		    game.setCollider(player,false)
		     HrpgCollider("collision",player)

Both VrpgCollider and HrpgCollider should be used together like the code above.