Skip to content

Instantly share code, notes, and snippets.

@teramotodaiki
Last active March 26, 2017 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teramotodaiki/e6de42b36e21cc34c3c33cc7b443fd0b to your computer and use it in GitHub Desktop.
Save teramotodaiki/e6de42b36e21cc34c3c33cc7b443fd0b to your computer and use it in GitHub Desktop.
import Assets from 'hackforplay/Assets';
import './maps';
// import 'mod/3d/core';
game.assets('gazou.png'); // 画像をロード
function main() {
// map1 をロード
Hack.maps['map1'].load();
// プレイヤー(騎士)をつくる
const player = Hack.player = new Player();
player.mod(Hack.assets.knight);
player.locate(3, 5);
player.hp = 3;
player.atk = 1;
player.onbecomedead = function() {
this.destroy();
Hack.gameover();
};
/* ____/ assets/ゲーム.json \____ */
// ハート
const item2 = new RPGObject();
item2.mod(Hack.assets.heart);
item2.locate(7, 5, 'map1');
item2.onplayerenter = function() {
Hack.player.hp += 1;
item2.destroy();
};
item2.image = game.assets['gazou.png']; // 見た目を変える
/* \____ assets/ゲーム.json ____/ */
}
game.onload = main;
Hack.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment