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 Profile Posts

Look, I get that it's illegal, but...
It just happen we got P7 as booth number, so i draw Girls Frontline's P7 in this
Stream will be live shortly! Going to start with some Minecraft spriting, and might switch mid-stream. Depends~ Feel free to drop by!
MushroomCake28 wrote on Finnuval's profile.
Glad to see you're back! I was wondering what you've become! It's been a while since we spoke to each other!
zachb wrote on Human_Male's profile.
I know this was months ago, but I don't completely understand the lunatic states program (how you set it up). I just want to apply a stone state (and death) to a character after x amount of time. Can you show me an example of how to set it up?

Forum statistics

Threads
93,469
Messages
912,748
Members
123,005
Latest member
Digimanthan
Top