Last active
June 6, 2016 09:34
-
-
Save teramotodaiki/bb0bacb4a24a712fe242aa5c5b6d6ef3 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
// ワープ | |
var warp = new MapObject('warp'); | |
warp.locate(7, 8, 'map1'); | |
warp.layer = RPGMap.Layer.Under; | |
warp.onplayerenter = function () { | |
Hack.player.locate(11, 5); | |
}; | |
warp.isKinematic = false; | |
warp.ontriggerenter = function (event) { | |
// event.hit ... 接触したもの | |
// onbecomeidle ... 歩きが止まった瞬間に | |
var tmp = event.hit.onbecomeidle; | |
event.hit.onbecomeidle = function () { | |
// this ... ここではwarpに触れたモノのこと | |
if (this === Hack.player) { | |
// プレイヤーなら… | |
} else { | |
// プレイヤー以外なら… | |
} | |
// this.locate(10, 5); | |
this.onbecomeidle = tmp || function () {}; | |
this.onbecomeidle(); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment