本文整理匯總了Golang中github.com/vova616/GarageEngine/engine.Arbiter.GameObjectA方法的典型用法代碼示例。如果您正苦於以下問題:Golang Arbiter.GameObjectA方法的具體用法?Golang Arbiter.GameObjectA怎麽用?Golang Arbiter.GameObjectA使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/vova616/GarageEngine/engine.Arbiter
的用法示例。
在下文中一共展示了Arbiter.GameObjectA方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OnCollisionEnter
func (pu *PowerUp) OnCollisionEnter(arbiter engine.Arbiter) bool {
if pu.GameObject() != nil && (arbiter.GameObjectA() == Player || arbiter.GameObjectB() == Player) {
PowerUpShip(pu.Type)
pu.GameObject().Destroy()
}
return true
}
示例2: OnCollisionPostSolve
func (s *Enemy) OnCollisionPostSolve(arbiter engine.Arbiter) {
if arbiter.GameObjectB() != nil {
if arbiter.GameObjectB().Tag != "lader" && arbiter.GameObjectA().Tag != "lader" {
count := 0
for _, con := range arbiter.Contacts {
if arbiter.Normal(con).Y < -0.9 {
count++
}
}
if count >= 1 {
if s.GameObject().Sprite.CurrentAnimation() == "enemy_jump" {
s.GameObject().Sprite.SetAnimation("enemy_stand")
}
s.LastFloor = arbiter.GameObjectB()
s.OnGround = true
}
count = 0
for _, con := range arbiter.Contacts {
if math.Abs(float64(arbiter.Normal(con).X)) > 0.9 {
count++
}
}
if count >= 1 {
s.jump = true
}
if arbiter.GameObjectB().Tag == "player" {
if Player.PlComp.Hitable && s.Attack {
Player.PlComp.Hit()
}
if s.hitable && Player.PlComp.Attack {
s.Hit()
}
}
}
}
}
示例3: OnCollisionPostSolve
func (pl *Player) OnCollisionPostSolve(arbiter engine.Arbiter) {
if arbiter.GameObjectB() == nil {
return
}
if arbiter.GameObjectB().Tag != "lader" && arbiter.GameObjectA().Tag != "lader" {
count := 0
for _, con := range arbiter.Contacts {
if arbiter.Normal(con).Y < -0.9 {
count++
}
}
if count >= 1 {
if pl.GameObject().Sprite.CurrentAnimation() == "player_jump" {
pl.GameObject().Sprite.SetAnimation("player_stand")
}
pl.LastFloor = arbiter.GameObjectB()
pl.OnGround = true
}
}
}