本文整理汇总了Golang中snake/player.Player.Position方法的典型用法代码示例。如果您正苦于以下问题:Golang Player.Position方法的具体用法?Golang Player.Position怎么用?Golang Player.Position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类snake/player.Player
的用法示例。
在下文中一共展示了Player.Position方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: create
func create(PlayerOne *player.Player, PlayerTwo *player.Player) {
if PlayerOne.Disconnected || PlayerTwo.Disconnected {
if !PlayerTwo.Disconnected {
Pair(PlayerTwo)
}
if !PlayerOne.Disconnected {
Pair(PlayerOne)
}
return
}
PlayerOne.Position = [][2]int{
[2]int{3, 7},
[2]int{3, 6},
[2]int{3, 5},
[2]int{3, 4},
[2]int{3, 3},
}
PlayerOne.Heading = "down"
PlayerTwo.Position = [][2]int{
[2]int{46, 42},
[2]int{46, 43},
[2]int{46, 44},
[2]int{46, 45},
[2]int{46, 46},
}
PlayerTwo.Heading = "up"
game := &Game{
Width: 50,
Height: 50,
PlayerOne: PlayerOne,
PlayerTwo: PlayerTwo,
Food: [][2]int{},
}
game.run()
}