本文整理汇总了Golang中github.com/awesomegroupidunno/game-server/state.Vehicle.Y方法的典型用法代码示例。如果您正苦于以下问题:Golang Vehicle.Y方法的具体用法?Golang Vehicle.Y怎么用?Golang Vehicle.Y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/awesomegroupidunno/game-server/state.Vehicle
的用法示例。
在下文中一共展示了Vehicle.Y方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: VehicleBounding
func (p *Physics) VehicleBounding(v *state.Vehicle) {
shouldStop := v.X < 0
if shouldStop {
v.X = 2
}
if v.Y < 0 {
shouldStop = true
v.Y = 2
}
if v.Y > p.WorldHeight {
shouldStop = true
v.Y = p.WorldHeight - 2
}
if v.X > p.WorldWidth {
shouldStop = true
v.X = p.WorldWidth - 2
}
if shouldStop {
v.Velocity = 0
}
}
示例2: RespawnVehicle
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
}
示例3: MoveVehicle
func (p *Physics) MoveVehicle(vehicle *state.Vehicle, duration time.Duration) {
x, y := p.move2d(vehicle.X, vehicle.Y, vehicle.Angle, vehicle.Velocity, duration)
vehicle.X = x
vehicle.Y = y
}