RPGJS 进阶分析之 推石头&&开箱子

本文介绍了一个使用RPGJS库加载游戏地图的例子,包括地图配置、角色位置设定及事件触发等关键细节。


<!DOCTYPE html>
<html>
  <head>
	<title>Example</title>
	<script src="rpg-beta-2.js"></script> 
	<script>
		var rpg;
		RPGJS.load(function() {
			rpg = new Rpg("canvas_rpg");
			rpg.loadMap('MAP010', {
				tileset: '023-FarmVillage01.png',
				events:['EV029','EV030'],
				player:  {
					x: 13, 
					y: 5, 
					filename: '001-Fighter01.png'
				}
			}, function () { 
				rpg.setScreenIn("Player"); 
			});
		});	
	</script>	
 </head>
  <body>
		<canvas id="canvas_rpg" width="640px" height="480px"></canvas> 
  </body>
</html>

EV029.json

[
    {
      "x": 5,
      "y": 6,
      "id": "29",
      "name": "EV029"
    },
    [
        {
            
            "character_hue": "182-Rock01.png","pattern": 0,
            "trigger": "action_button",
            "direction": "bottom",
            "frequence": 16,
            "type": "fixed",
            "through": false,
            "stop_animation": false,
            "no_animation": false,
            "direction_fix": false,
            "alwaysOnTop": false,
            "speed": 4,
            "commands": [
              "MOVE_ROUTE: ['step_backward']",
 ""
            ]
        }
    ]
]


EV030.json

[
    {
      "x": 13,
      "y": 7,
      "id": "30",
      "name": "EV030"
    },
    [
        {
            
            "character_hue": "174-Chest01.png","pattern": 0,
            "trigger": "action_button",
            "direction": "bottom",
            "frequence": 16,
            "type": "fixed",
            "through": false,
            "stop_animation": false,
            "no_animation": false,
            "direction_fix": false,
            "alwaysOnTop": false,
            "speed": 4,
            "commands": [
              "SELF_SWITCH_ON: 'A'"
            ]
        },
        {
            "conditions": {"self_switch": "A"},
            "character_hue": "174-Chest01.png","pattern": 0,
            "trigger": "action_button",
            "direction": "up",
            "frequence": 16,
            "type": "fixed",
            "through": false,
            "stop_animation": false,
            "no_animation": false,
            "direction_fix": false,
            "alwaysOnTop": false,
            "speed": 4,
            "commands": [
            ]
        }
    ]
]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值