本文整理匯總了Golang中github.com/runningwild/jota/game.Ent.Angle方法的典型用法代碼示例。如果您正苦於以下問題:Golang Ent.Angle方法的具體用法?Golang Ent.Angle怎麽用?Golang Ent.Angle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/runningwild/jota/game.Ent
的用法示例。
在下文中一共展示了Ent.Angle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getFrontPos
func (f *fire) getFrontPos(ent game.Ent, g *game.Game) linear.Vec2 {
r := rand.New(g.Rng)
theta := r.Float64() * math.Pi * 2
dist := math.Abs(r.NormFloat64() * f.deviance)
if dist > f.deviance*4 {
dist = f.deviance * 4
}
dist = dist + dist*math.Cos(theta)
center := (linear.Vec2{f.distToCenter, 0}).Rotate(ent.Angle()).Add(ent.Pos())
return (linear.Vec2{0, dist}).Rotate(ent.Angle() - math.Pi/2 + theta).Add(center)
}
示例2: Draw
func (f *lightning) Draw(ent game.Ent, g *game.Game) {
if !f.draw {
return
}
gl.Disable(gl.TEXTURE_2D)
gl.Color4ub(255, 255, 255, 255)
forward := (linear.Vec2{1, 0}).Rotate(ent.Angle()).Scale(100000.0)
gl.Begin(gl.LINES)
v := ent.Pos().Add(forward)
gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
v = ent.Pos().Sub(forward)
gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
gl.End()
}
示例3: Input
func (pm *placeMine) Input(ent game.Ent, g *game.Game, pressAmt float64, trigger bool) {
player := ent.(*game.PlayerEnt)
if pressAmt == 0 {
delete(player.Processes, pm.id)
return
}
proc, ok := player.Processes[pm.id].(*multiDrain)
if !ok {
player.Processes[pm.id] = &multiDrain{Gid: player.Gid, Unit: game.Mana{300, 0, 0}}
return
}
if trigger && proc.Stored > 1 {
proc.Stored--
heading := (linear.Vec2{1, 0}).Rotate(ent.Angle())
pos := ent.Pos().Add(heading.Scale(100))
g.MakeMine(pos, linear.Vec2{}, 100, 100, 100, 100)
}
}