Skip to content

Commit 2a22860

Browse files
committed
update data
1 parent b8ccbe4 commit 2a22860

File tree

2 files changed

+21
-0
lines changed
  • 第一季 从零开始写游戏服务器 第二期/最新课节--课程代码/class3/src/classcode

2 files changed

+21
-0
lines changed

第一季 从零开始写游戏服务器 第二期/最新课节--课程代码/class3/src/classcode/NetSnakeClt.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ import (
77
"fmt"
88
)
99

10+
// 玩家的坐标信息
11+
type SnakePlayer struct {
12+
OpenID string
13+
X_Pos int
14+
Y_Pos int
15+
}
16+
17+
// 食物的坐标
18+
// 变化的、被吃掉后重新生成。
19+
type SnakeFood struct {
20+
X_Pos int
21+
Y_Pos int
22+
}
23+
1024
// 子协议的处理
1125
func (this *NetDataConn) HandleCltProtocol2Snake(protocol2 interface{}, ProtocolData map[string]interface{}) {
1226

第一季 从零开始写游戏服务器 第二期/最新课节--课程代码/class3/src/classcode/init.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,10 @@ func GameServerReceive(ws *websocket.Conn) {
8787
func base64Decode(src []byte) ([]byte, error) {
8888
return base64.StdEncoding.DecodeString(string(src))
8989
}
90+
91+
// 初始化贪吃蛇地图数据
92+
func Init_SnakeMap() {
93+
// 1 首先地图是20*20大小的数据
94+
// 2
95+
return
96+
}

0 commit comments

Comments
 (0)