Hi,
I modify some class of my games to prevent the camera from having a limit.
Now the camera always follows the player even at the end limit of the map
i remove in Game_Map.prototype.scroll....
to
This seems to work perfectly.
My problem is that I use parraxes for mapping.
And strange, when the camera is out of the game limits.
The parallaxes repeat?.
In the idea, I would be supposed to see black color body out limit?
<body style="background-color: black">
So I'm looking for the class that makes the parralaxe work like a bitmap loop?
Someone knows the classes to look at, or would have clues about research?
I need parallax work like picture.
I thought I'd found something interesting here.
But I am not able to remove the loops of the parralaxes.
Thanks a lot for help
I modify some class of my games to prevent the camera from having a limit.
Now the camera always follows the player even at the end limit of the map
i remove in Game_Map.prototype.scroll....
Code:
this._displayY = Math.min(this._displayY + distance,
this.height() - this.screenTileY());
Code:
this._displayY += distance;
My problem is that I use parraxes for mapping.
And strange, when the camera is out of the game limits.
The parallaxes repeat?.
In the idea, I would be supposed to see black color body out limit?
<body style="background-color: black">
So I'm looking for the class that makes the parralaxe work like a bitmap loop?
Someone knows the classes to look at, or would have clues about research?
I need parallax work like picture.
I thought I'd found something interesting here.
But I am not able to remove the loops of the parralaxes.
Code:
/////
Game_Map.prototype.setDisplayPos = function(x, y) {
if (this.isLoopHorizontal()) {
this._displayX = x.mod(this.width());
this._parallaxX = x;
console.log(0);
} else {
var endX = this.width() - this.screenTileX();
this._displayX = endX < 0 ? endX / 2 : x.clamp(0, endX);
this._parallaxX = this._displayX;
console.log(1);
}
if (this.isLoopVertical()) {
this._displayY = y.mod(this.height());
this._parallaxY = y;
console.log(2);
} else {
var endY = this.height() - this.screenTileY();
this._displayY = endY < 0 ? endY / 2 : y.clamp(0, endY);
this._parallaxY = this._displayY;
console.log(3);
}
};
//////////////
/*
* Simple fix for canvas parallax issue, destroy old parallax and readd to the tree.
*/
Spriteset_Map.prototype._canvasReAddParallax = function() {
var index = this._baseSprite.children.indexOf(this._parallax);
console.log('index: ', index);
this._baseSprite.removeChild(this._parallax);
this._parallax = new TilingSprite();
this._parallax.move(0, 0, Graphics.width, Graphics.height);
this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName);
this._baseSprite.addChildAt(this._parallax,index);
};
Spriteset_Map.prototype.updateParallax = function() {
if (this._parallaxName !== $gameMap.parallaxName()) {
this._parallaxName = $gameMap.parallaxName();
if (this._parallax.bitmap && Graphics.isWebGL() != true) {
this._canvasReAddParallax();
} else {
this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName);
}
}
if (this._parallax.bitmap) {
this._parallax.origin.x = $gameMap.parallaxOx();
this._parallax.origin.y = $gameMap.parallaxOy();
}
};
Thanks a lot for help