iT邦幫忙

2022 iThome 鐵人賽

DAY 27
0
Software Development

用程式寫遊戲給AI玩系列 第 27

實作!雙人射擊遊戲 —— 撰寫 MLPlay 積木

  • 分享至 

  • xImage
  •  

今天的內容為,定義要給AI的資料,並撰寫 MLPlay 積木

先貼積木,之後再補文章
(第 24 天的 「實作!雙人射擊遊戲 —— 重構怪物的移動」 和第 25 天的「實作!雙人射擊遊戲 —— 怪物掉落」 文章已補上,大家可以先看!/images/emoticon/emoticon41.gif

{
    "INIT_INFO": [
        ["ai_name", "player number", "玩家編號"]
    ],
    "PLAYER_STATUS":[
        ["1P", "1P", "1P"],
        ["2P", "2P", "2P"]
    ],
    "GAME_STATUS": [
        ["GAME_ALIVE", "alive", "存活"],
        ["GAME_OVER", "over", "失敗"],
        ["GAME_1P_WIN", "1P wins", "1P 獲勝"],
        ["GAME_2P_WIN", "2P wins", "2P 獲勝"]
    ],
    "SCENE_INFO": [
        ["scene_info['id']", "player number", "玩家編號"],
        ["scene_info['x']", "x coordinate of player", "玩家的 x 座標"],
        ["scene_info['y']", "y coordinate of player", "玩家的 y 座標"],
        ["scene_info['vel']", "player velocity", "玩家速度"],
        ["scene_info['score']", "score of player", "玩家分數"],
        ["scene_info['shield']", "shield of player", "玩家護盾值"],
        ["scene_info['lives']", "lives of player", "玩家的生命次數"],
        ["scene_info['angle']", "angle of player", "玩家的面朝角度"],
        ["scene_info['used_frame']", "# frame", "# 幀數"],
        ["scene_info['status']", "game status", "遊戲狀態"],
        ["scene_info['partner_info']", "coordinate of partner", "夥伴的所有資訊"],
        ["scene_info['mob_info']", "coordinate of all mobs", "所有怪物的所有資訊"]
    ],
    "CONSTANT": [
        [0, "left boundary", "左邊界"],
        [800, "right boundary", "右邊界"],
        [0, "top boundary", "上邊界"],
        [600, "bottom boundary", "下邊界"],
        [50, "obj width", "物件寬度"],
        [50, "obj height", "物件高度"]
    ],
    "ACTION": [
        ["['UP']", "move up", "往上"],
        ["['DOWN']", "move down", "往下"],
        ["['LEFT']", "move left", "往左"],
        ["['RIGHT']", "move right", "往右"],
        ["['SHOOT']","shoot", "射擊"],
        ["['UP', 'SHOOT']", "move up and shoot", "前進並射擊"],
        ["['DOWN', 'SHOOT']", "move down and shoot", "後退並射擊"],
        ["['LEFT', 'SHOOT']", "move left and shoot", "左轉並射擊"],
        ["['RIGHT', 'SHOOT']", "move right and shoot", "右轉並射擊"],
        ["['NONE']","doing nothing", "不動作"],
        ["RESET", "reset", "重置遊戲"]
    ]
}

上一篇
實作!雙人射擊遊戲 —— 玩家與怪物的碰撞
下一篇
在 PAIA-Desktop 上遊玩自己的遊戲
系列文
用程式寫遊戲給AI玩30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言