Exemplo n.º 1
0
func TestBox2dPowerup(t *testing.T) {
	powerup := state.Powerup{
		Point: state.Point{X: 10,
			Y: 20},
		Sized: state.Sized{Width: 15,
			Height: 15}}
	Convey("Proper Box Powerup", t, func() {
		So(powerup.AngleDegrees(), ShouldAlmostEqual, 0, .001)
		x, y := powerup.Position()
		w, h := powerup.Size()

		So(x, ShouldAlmostEqual, powerup.X, .001)
		So(y, ShouldAlmostEqual, powerup.Y, .001)
		So(w, ShouldAlmostEqual, powerup.Height, .001)
		So(h, ShouldAlmostEqual, powerup.Width, .001)

	})
}
Exemplo n.º 2
0
func (p *Physics) PickupPowerUp(v1 *state.Vehicle, power *state.Powerup) {
	if v1.IsAlive && !power.ShouldRemove {
		power.ShouldRemove = true
		v1.StoredPowerup = power.PowerupType
	}
}