func (t *PowerupCommandProcessor) placeWell(v *state.Vehicle, g *state.GameState) { v.StoredPowerup = NO_POWERUP r := state.GravityWell{ Point: state.NewPoint(v.X, v.Y), Sized: state.NewSized(10, 10), Owner: v.Owner, Expires: time.Now().Add(5 * time.Second), } g.GravityWells = append(g.GravityWells, &r) }
func (t *PowerupCommandProcessor) fireRocket(v *state.Vehicle, g *state.GameState) { v.StoredPowerup = NO_POWERUP targetedVehicle := targetVehicle(v, g) r := state.Rocket{ Point: state.NewPoint(v.X, v.Y), Sized: state.NewSized(t.Physics.BulletWidth*3, t.Physics.BulletWidth*1.25), Target: targetedVehicle, Velocity: t.Physics.BulletVelocity * .75, } g.Rockets = append(g.Rockets, &r) }
func (p *Physics) RespawnVehicle(v *state.Vehicle, g state.GameState) bool { if !v.IsAlive { if time.Now().After(v.TimeDestroyed.Add(p.VehicleRespawn)) { v.IsAlive = true loc := p.findSpace(v.Sized, g) v.Y = loc.Y v.X = loc.X v.Angle = 0 v.CurrentHealth = v.MaxHealth v.ActivePowerup = NO_POWERUP v.StoredPowerup = NO_POWERUP } } return false }
func (t *PowerupCommandProcessor) applySpeedPowerUp(v *state.Vehicle) { v.ActivePowerup = SPEEDUP v.StoredPowerup = NO_POWERUP v.OverRideSpeedTill = time.Now().Add(10 * time.Second) }
func (t *PowerupCommandProcessor) healVehicle(v *state.Vehicle) { v.CurrentHealth = v.MaxHealth v.StoredPowerup = NO_POWERUP }
func (p *Physics) PickupPowerUp(v1 *state.Vehicle, power *state.Powerup) { if v1.IsAlive && !power.ShouldRemove { power.ShouldRemove = true v1.StoredPowerup = power.PowerupType } }