func (p *Physics) DamageBase(b *state.Bullet, base *state.Base) bool { base.CurrentHealth -= p.BulletDamage b.ShouldRemove = true if base.CurrentHealth <= 0 { base.CurrentHealth = 0 return true } return false }
func TestBox2dBase(t *testing.T) { bullet := state.Base{ Point: state.Point{X: 10, Y: 20}, Sized: state.Sized{Width: 15, Height: 15}} Convey("Proper Box Base", t, func() { So(bullet.AngleDegrees(), ShouldAlmostEqual, 0, .001) x, y := bullet.Position() w, h := bullet.Size() So(x, ShouldAlmostEqual, bullet.X, .001) So(y, ShouldAlmostEqual, bullet.Y, .001) So(w, ShouldAlmostEqual, bullet.Height, .001) So(h, ShouldAlmostEqual, bullet.Width, .001) }) }