Last active
March 26, 2017 13:31
-
-
Save teramotodaiki/e6de42b36e21cc34c3c33cc7b443fd0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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