1、基于lufylegend引擎的魔塔游戏开发(设计介绍)

使用的引擎

lufylegend
也是第一次写rpg游戏,主要是兴趣使然
游戏体验地址(未完成)git

游戏设计

  1. 游戏图层设计github

    var layers = {
      back: null,
      mapview: null,
      things: null,
      effect: null,
      talk: null,
    };

    游戏图层分为了五层。
    分别是底层、地图层、物品层、数据展现层、对话层。设计

  2. 游戏数据存储code

    globalData = {
      mapCol: 11,
      mapRow: 11,
      size: 32,
      floor: 0, 
      playerInfo: {
        HP: 1000,
        ATK: 10,
        DEF: 10,
        money: 0,
        XP: 0,
        status: 'ArrowDown',
        key: {
          yellow: 1,
          blue: 1,
          red: 1
        }
      },
      data: [{
        playerPosition: {
          x: 5,
          y: 10
        },
        map: [
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1],
          [1, 1, 2, 2, 2, 0, 2, 2, 2, 1, 1],
          [1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
          [3, 1, 3, 1, 0, 0, 0, 1, 3, 1, 3],
          [3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3],
          [3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3]
        ],
        things: [
          [0, 0, 0, 0, 0, "goods_0_1", 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, "npc3", 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
          [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ]
      }]
    }

    将游戏涉及的全部数据存放到一个对象中,能够在后期很方便的作游戏进度保存。
    其中playerInfo为角色的属性信息。
    data为全部地图的信息对象

  3. 配置文件
    由于物品的功能和怪物的属性是不固定的,因此须要手动编辑怪物的属性以及定义物品拾取的handel方法游戏

    var configGoods = {
      'goods_0_0': {
        x: 0,
        y: 0,
        handel: function() {
          globalData.floor--;
          gameInfo.floor.text = '第' + globalData.floor + '层';
          drawInit();
        }
      }
    }
    
    var configChara = {
      'monster0': {
        y: 6,
        HP: 50,
        ATK: 20,
        DEF: 1,
        money: 1,
        XP: 1
      }
    }
相关文章
相关标签/搜索