Looping picture

lawina

Veteran
Veteran
Joined
Sep 4, 2015
Messages
147
Reaction score
28
First Language
English
Primarily Uses
Is there a way to make a seamless picture to loop endlessly? My game screen size is 1296x768 and the seamless picture is 1296x1296. I tried using the loop command, like this:



However, it doesn't work well. After a few seconds the pictures start appearing on top of each-other. Probably due to the unstable FPS?

Is there any other way to do this?

Any help is appreciated. Cheers!
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
580
First Language
English
Primarily Uses
RMMV
I played around with this and I came up with the TilingSprite because you can control its origin rather than its position and it's tiled.

The only way I could figure out how to get a tilingsprite onto the game's base sprite is with this little plugin.
PHP:
Spriteset_Base.prototype.createUpperLayerOld = Spriteset_Base.prototype.createUpperLayer;
var tiledpicture;
Spriteset_Base.prototype.createUpperLayer = function() {
   tiledpicture = new TilingSprite();
   tiledpicture.bitmap = ImageManager.loadBitmap("img/pictures/","DarkSpace1OpacityEdit", 0, true);
   tiledpicture.move(0, 0, 0, 0);
   this._baseSprite.addChild(tiledpicture);
   return Spriteset_Base.prototype.createUpperLayerOld.apply(this, arguments);
}
Where DarkSpace1OpacityEdit would be your picture.

Then to show picture by event script just call this once.
PHP:
tiledpicture.move(0, 0, Graphics.width, Graphics.height);
And to make it move call this in a parallel process.
PHP:
// where this will be += or -= for your moving speed.
tiledpicture.origin.x += 0.5;
tiledpicture.origin.y += 0.5;
I hope somebody who knows how to access the base sprite through $gameMap or $gameScreen or something chimes in, because I don't know where that property ends up for event script.


I just added some opacity to a game parallax img to test this. It doesn't perfectly tile up or anything, but it's length and width looping with no overlap.
 
Last edited:

lawina

Veteran
Veteran
Joined
Sep 4, 2015
Messages
147
Reaction score
28
First Language
English
Primarily Uses
I just added some opacity to a game parallax img to test this. It doesn't perfectly tile up or anything, but it's length and width looping with no overlap.
Epic, thank you very much!
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
580
First Language
English
Primarily Uses
RMMV
I forgot to mention.
PHP:
tiledpicture.move(0, 0, 0, 0);
To turn it off again or it will show the whole game.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Tune in next time for our newest Episode: "PC issues return! Palm uses every swear in the lexicon!"
gotta update my game project thread page later
So trying out Ultra Mode 7 was a bad idea. How do I not include this in my game? XD
Stumbled upon an RPG Maker game on Steam called 'Boobs vs Zombies' while looking for a zombie themed fantasy RTS. lol
There's a new born faction in my country called "Sunda Empire" claiming they have right to rule over the earth and sun... I don't know what to feel...

Forum statistics

Threads
93,551
Messages
913,408
Members
123,085
Latest member
Oxid
Top