Exemplo n.º 1
0
func (p *Physics) damageVehicle(v *state.Vehicle, amount int) bool {
	if v.IsAlive {
		v.CurrentHealth -= amount
		if v.CurrentHealth <= 0 {
			v.CurrentHealth = 0
			v.IsAlive = false
			v.TimeDestroyed = time.Now()
			return true
		}
	}
	return false
}
Exemplo n.º 2
0
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
}
Exemplo n.º 3
0
func (t *PowerupCommandProcessor) healVehicle(v *state.Vehicle) {
	v.CurrentHealth = v.MaxHealth
	v.StoredPowerup = NO_POWERUP
}