kaplayjs / kaplay

🦖 A JavaScript/TypeScript Game Library that feels like a game, fun
https://kaplayjs.com
MIT License
567 stars 38 forks source link

feat: Improved hitboxes and collisions #81

Open sharmnten opened 5 months ago

sharmnten commented 5 months ago

The problem I'm always frustrated when in my game, the hit-boxes of various game objects are slightly to large, resulting in the player being able to float off corners.

The solution I would like Improved hit boxes and collision recognition in kaplay.

Additional context image

niceEli commented 5 months ago

can you enable debug to show the hitboxes (F1 key or debug.inspect = true)

sharmnten commented 5 months ago
image
niceEli commented 5 months ago

this happens because of the bounding box for the hitbox being the size of the sprite

if you would like to customize it then you can change the size using the the area component API https://kaplayjs.com/reference/#area