Пример #1
0
func TestNull(t *testing.T) {
	hb := hitbox.NewNull()

	contour := hb.Contour(nil)
	if len(contour) != 0 {
		t.Fatal("Null hitbox contour must be empty")
	}
}
Пример #2
0
func GetHitbox(sprite message.Sprite) hitbox.Hitbox {
	switch sprite {
	case PlaceholderSprite:
		return hitbox.NewNull()
	case PlayerSprite:
		return hitbox.NewCircle(10)
	case BallSprite:
		return hitbox.NewCircle(10)
	}
	return nil
}