加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
以下代码画出的效果会在人物和地图之上,请教大神。
var MyBitmapAlias = Spriteset_Map.prototype.createCharacters; Spriteset_Map.prototype.createCharacters = function() { if ($gameMap.mapId() == tankPos[0][2]){ this.sprite = new Sprite(); this.sprite.bitmap = ImageManager.loadCharacter('$Tank01'); this.sprite.setFrame(32, 32, 32, 32); this.addChild(this.sprite); // get player's coordinate this.sprite.x = $gamePlayer.screenX() - ($gamePlayer.x - tankPos[0][0]) * 48 - 18; this.sprite.y = $gamePlayer.screenY() - ($gamePlayer.y - tankPos[0][1]) * 48 + 12; this.sprite.z = 2; } MyBitmapAlias.call(this); }; var updateMyBitmap = Spriteset_Map.prototype.update; Spriteset_Map.prototype.update = function() { //If we wanted to spin the sprite constantly we'd do it //here, like so. this.sprite.x = $gamePlayer.screenX() - ($gamePlayer._realX - tankPos[0][0]) * 48 - 18; this.sprite.y = $gamePlayer.screenY() - ($gamePlayer._realY - tankPos[0][1]) * 48 + 12; this.sprite.z = 2; updateMyBitmap.call(this); };
var MyBitmapAlias = Spriteset_Map.prototype.createCharacters;
Spriteset_Map.prototype.createCharacters = function() {
if ($gameMap.mapId() == tankPos[0][2]){
this.sprite = new Sprite();
this.sprite.bitmap = ImageManager.loadCharacter('$Tank01');
this.sprite.setFrame(32, 32, 32, 32);
this.addChild(this.sprite);
// get player's coordinate
this.sprite.x = $gamePlayer.screenX() - ($gamePlayer.x - tankPos[0][0]) * 48 - 18;
this.sprite.y = $gamePlayer.screenY() - ($gamePlayer.y - tankPos[0][1]) * 48 + 12;
this.sprite.z = 2;
}
MyBitmapAlias.call(this);
};
var updateMyBitmap = Spriteset_Map.prototype.update;
Spriteset_Map.prototype.update = function() {
//If we wanted to spin the sprite constantly we'd do it
//here, like so.
this.sprite.x = $gamePlayer.screenX() - ($gamePlayer._realX - tankPos[0][0]) * 48 - 18;
this.sprite.y = $gamePlayer.screenY() - ($gamePlayer._realY - tankPos[0][1]) * 48 + 12;
this.sprite.z = 2;
updateMyBitmap.call(this);
};
|