Jump to content
  • 1

How can I relocate the position of the hitbox?


drackreborn

Question

I have a spaceship game, the problem arose when I decided to add larger ships, I have noticed that by default the character's "hitbox" is always located in the center of the bottom part of the sprite, which makes it very difficult to hit projectiles against targets of a larger size. It also makes it so that when the sprite is looking from the side, the projectiles are generated at the "feet" of the ship which looks horrible aesthetically and also makes aiming worse.

What I'm looking for is a way for the character's hitbox to align in the center of the sprite, both horizontally and vertically.

799afd38ad0483087c746942ca2b860a.png
projectiles being fired from a ship with 64x64 resolution

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You're going to have to change the source for this. The hitbox is hardcoded to be the tile a sprite is standing on, and the the tile is expected to be where the "feet" of a sprite are, which applies when the sprites are intended to be at a ~45deg angle, but your game is 90deg angle looking directly down at the map.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...