hi, I try somehow to understand the inner workings of the map in the source code of rmmv but I have a lot of difficulty to understand everything.
there are specialists who could bring me some clarification?
My issue is the following.
The basic parallax system of rmmv is not necessary for me, however I want to add a picture in the background that will have the role of the map camera.
in logic this image will have the behavior of the parallax system, without the infinite painting.
I attacked for several days the code that affects map camera and parralaxe , but without real success.
How the hell this work ?
how i can replace parralaxe by a single sprite pixi texture without loop ??
i made little video to help understand my target.
it's really because I do not understand anything despite all my efforts on how the basic paralaxe and camera work!.
thanks in advance for help.
i try many code changes, but i cannot understand how the camera and parallaxe work.
here the basic am try understand., Am not shure its the good way, but if you have more good idea or understand more than me the system thank to help.
there are specialists who could bring me some clarification?
My issue is the following.
The basic parallax system of rmmv is not necessary for me, however I want to add a picture in the background that will have the role of the map camera.
in logic this image will have the behavior of the parallax system, without the infinite painting.
I attacked for several days the code that affects map camera and parralaxe , but without real success.
How the hell this work ?
how i can replace parralaxe by a single sprite pixi texture without loop ??
PHP:
Spriteset_Map.prototype.createParallax = function() {
this._parallax = new TilingSprite();
this._parallax.alpha = 0.5;
this._parallax.move(0, 0, Graphics.width, Graphics.height);
this._baseSprite.addChild(this._parallax);
var layers = pixiSSA.get_layer_parallax();
for(var i = 0, l = layers.length; i<l; i++){ this._baseSprite.addChild(layers[i]) }; // add layers parallax
this._atestMap = new PIXI.Sprite.fromImage('C:/Users/jonle/Documents/Games/A NEW FANTASTIQUE TIME TOME1/img/parallaxes/'+"!A-jcartoon2.png");
this._atestMap.alpha = 0.8;
this._baseSprite.addChild(this._atestMap);
};
i made little video to help understand my target.
it's really because I do not understand anything despite all my efforts on how the basic paralaxe and camera work!.
thanks in advance for help.
i try many code changes, but i cannot understand how the camera and parallaxe work.
here the basic am try understand., Am not shure its the good way, but if you have more good idea or understand more than me the system thank to help.
PHP:
// LAYER ASIGNATION TO MAP
Spriteset_Map.prototype.createLowerLayer = function() {
Spriteset_Base.prototype.createLowerLayer.call(this);
this.createParallax(); // Create parralaxe and add parralaxe layers
this.createTilemap();
this.createCharacters();
this.createShadow();
this.createDestination();
this.createWeather();
//plugin
this.addLayersEvents(); // add eventsLayers with .z (from rmmv)
this.addLayersTop();
console.log('thisSpriteset_Map ', this); // contien tous parralaxe, event layer, saufe top layer
};
Spriteset_Map.prototype.createParallax = function() {
this._parallax = new TilingSprite();
this._parallax.alpha = 0.5;
this._parallax.move(0, 0, Graphics.width, Graphics.height);
this._baseSprite.addChild(this._parallax);
var layers = pixiSSA.get_layer_parallax();
for(var i = 0, l = layers.length; i<l; i++){ this._baseSprite.addChild(layers[i]) }; // add layers parallax
this._atestMap = new PIXI.Sprite.fromImage('C:/Users/jonle/Documents/Games/A NEW FANTASTIQUE TIME TOME1/img/parallaxes/'+"!A-jcartoon2.png");
this._atestMap.alpha = 0.8;
this._baseSprite.addChild(this._atestMap);
};
Spriteset_Map.prototype.addLayersEvents = function() {
var layers = pixiSSA.get_layer_events();
for(var i = 0, l = layers.length; i<l; i++){ this._tilemap.addChild(layers[i]) }; // add layers events
};
Spriteset_Map.prototype.addLayersTop = function() {
var layers = pixiSSA.get_layer_top();
for(var i = 0, l = layers.length; i<l; i++){ this.addChild(layers[i]) };// add layers top
};
Game_Map.prototype.scrollDown = function(distance) { // remove limite Camera, free cam limite
if (this.height() >= this.screenTileY()) {
var lastY = this._displayY;
this._displayY = Math.min(this._displayY + distance); // ,this.height() - this.screenTileY()
this._parallaxY += this._displayY - lastY;
};
};
Game_Map.prototype.scrollLeft = function(distance) { // remove limite Camera, free cam limite
if (this.isLoopHorizontal()) {
this._displayX += $dataMap.width - distance;
this._displayX %= $dataMap.width;
if (this._parallaxLoopX) {
this._parallaxX -= distance;
}
} else if (this.width() >= this.screenTileX()) {
var lastX = this._displayX;
this._displayX = Math.max(this._displayX - distance); // , 0
this._parallaxX += this._displayX - lastX;
}
};
Game_Map.prototype.scrollRight = function(distance) { // remove limite Camera, free cam limite
if (this.isLoopHorizontal()) {
this._displayX += distance;
this._displayX %= $dataMap.width;
if (this._parallaxLoopX) {
this._parallaxX += distance;
}
} else if (this.width() >= this.screenTileX()) {
var lastX = this._displayX;
this._displayX = Math.min(this._displayX + distance); // ,this.width() - this.screenTileX()
this._parallaxX += this._displayX - lastX;
};
};
Game_Map.prototype.scrollUp = function(distance) { // remove limite Camera, free cam limite
if (this.isLoopVertical()) {
this._displayY += $dataMap.height - distance;
this._displayY %= $dataMap.height;
if (this._parallaxLoopY) {
this._parallaxY -= distance;
}
} else if (this.height() >= this.screenTileY()) {
var lastY = this._displayY;
this._displayY = Math.max(this._displayY - distance); // , 0
this._parallaxY += this._displayY - lastY;
}
};
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();
this._atestMap.x = -$gameMap.parallaxOx();
this._atestMap.y = -$gameMap.parallaxOy();
}
};