The Basics Module contains ready-made pieces that lots of games need. Right now that's the SquareKickbox.
The Basics Module's classes can be accessed with new MDog.Basics.ClassName().
A SquareKickbox is a rectangle hitbox for checking collisions. It's attached to a position Vector, so when the vector moves the kickbox moves with it. The corners are offsets from that position, so the kickbox can be a different size than the sprite.
const position = new MDog.Math.Vector(50, 50);
const hitbox = new MDog.Basics.SquareKickbox(position, 2, 0, 14, 16);
position.add(1, 0); // The hitbox moves too
if (hitbox.colliding(enemyHitbox)) {
...
}
Positions are whole pixels on screen. The position vector is rounded down first.