Document stub.png This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (May 2018)

Hitboxes are common methods used for overworlds, platformers, and so on. They are used as the shape that collides with other objects, seeing as more detailed images can easily affect how smoothly the game runs. Like the name suggests, it's usually just a black rectangle, being the same general size.

Scratch Cat with a suitable hitbox.

Uses of a Hitbox

Hitboxes are great ways of avoiding unncessary lag in platformers and other similar games, and are also used for more detailed characters / player avatars. They generally make projects run smoother. When making a hitbox, it is essential that it is roughly the same size as the player, otherwise the hitbox can make games very innacurate. [citation needed]

How to Program Your Own Hitbox

Programming your own hitbox a great way to make your platformers run even smoother, so here is a guide on how to!

Drawing a Hitbox

To start, create a new sprite for the hitbox and open the 'costumes tab'. If you haven't already, download onto your computer (or backpack if you are using the online editor)the first costume for your character and then upload it into a blank vector costume in your hitbox sprite. Using the rectangle tool, draw a square or rectangle over your character and make it as small as you can without any part of the character showing. Now remove the character from behind and you have your hitbox square.

Programming the Hitbox

After you have made the sprite, you will need a platformer script inside the scripts area. If you don't know how to make one, a tutorial can be found here.

Linking the Two Sprites

Now that you have made the hitbox, you will now need to connect it to the character with this simple script:

when gf clicked
  go to [Hitbox v]

Now, run your project and everything should be a lot smoother.