蛇的控制逻辑,增长逻辑,碰撞检测改为后端实现 + 结果计分板实现

This commit is contained in:
2023-03-03 16:51:58 +08:00
parent 4b3ebf9d77
commit ae4d8ef42d
10 changed files with 475 additions and 23 deletions
+23
View File
@@ -7,10 +7,20 @@ export default {
// 对手信息
opponent_username: "",
opponent_photo: "",
// 地图信息(后端传入)
game_map: null,
rows: 0,
cols: 0,
inner_walls_count: 0,
a_id: 0,
a_sx: 0,
a_sy: 0,
b_id: 0,
b_sx: 0,
b_sy: 0,
// 游戏全局
game_object: null,
loser:"none", // all, A, B 三种结果
},
getters: {},
mutations: {
@@ -33,7 +43,20 @@ export default {
state.rows = game_data.rows;
state.cols = game_data.cols;
state.inner_walls_count = game_data.inner_walls_count;
state.a_id = game_data.a_id;
state.a_sx = game_data.a_sx;
state.a_sy = game_data.a_sy;
state.b_id = game_data.b_id;
state.b_sx = game_data.b_sx;
state.b_sy = game_data.b_sy;
},
updateGameObject(state, game_object){
// 在 GameMap.vue 中使用
state.game_object = game_object;
},
updateLoser(state,loser){
state.loser = loser;
}
},
actions: {},
module: {},