Making the same picture loop over and over and over.

This tutorial will explain to you the simple way to making a picture loop over and over again. This can be useful if you're making a slotmachine, where you want a picture to loop and loop until the player presses a button. Or whatever else you want to use it for.

For the sake of this tutorial, I will be using

- A simple 20x15 tiles map (320x240 pixels)

- The panorama "planet1" from the RPG Maker RTP. It's 320x240 pixels, so perfect for this example. We'll import it as a picture. For this picture it doesn't matter what you set as transparency, since we'll set transparency off anyways. If you're using a picture with transparent parts, import them and select transparency as needed.

One important thing to know about pictures is that RPG Maker always uses the exact center of the picture to place it. Which means, if we're using a 320x240 picture, the center is at 160x120. When placing pictures at certain coordinates it's useful to remember this.

Alright, now we have everything we need to make this work.

Start off by making an event on your map that's a Parallel Process. Next, enter the following commands:

First make a Show Picture that displays our "planet1" picture. Make the coordinates as 160x120, the exact center of the screen. And for this example we'll also set "Transparent Color" to "None".

Next we'll make a second Show Picture command that once again displays "planet1". Make sure to change the picture ID to 2. Leave the X coordinate as the previous picture, but set the Y coordinate to 360.

For testing purposes it might be useful to put a "Key Input Processing" here. You can remove it later as you see fit. I made it the Shift key and set the variable to an empty 0001. Also check "Wait Until Key Pressed".

Next, put in a "Loop" command. Since we want the picture to keep scrolling endlessly, a loop works perfect for this. Whenever you want the picture to stop scrolling you can use "Break out of loop", but I'll let you decide that.

Alright, now inside the loop, go ahead and put a "Move Picture" command. First we'll be moving picture no. 1. Leave the X coordinate as it is, and change the Y coordinate to -120. This will move the picture up, entirely out of the screen. Leave the transition time to 10 tenths of a second, but make sure to uncheck "Halt Other Processes During Transition".

Next, we'll move picture no. 2. Move it to coordinates 160x120, the location where previously picture 1 was. Once again make transition time 10 tenths of a second, but this time do check "Halt Other Processes During Transition".

Next, we'll erase picture no. 1, since it's outside the screen and we don't need it there anymore.

Immediately after, we'll once again show picture no. 1, but this time we'll place it in the position where picture 2 once was: 160x360, right beneath the screen.

Now, we'll be moving picture no. 2 to 160x-120, which is above the screen. Transition time 10 tenths of a second, uncheck halt processes.

Then we'll be moving picture no. 1 again, to inside the screen: 160x120. Transition time, 10 tenths of a second, do check halt processes.

Now we'll erase picture 2, and then immediately show it again beneath the screen: at 160x360.

The next move would be to move picture 1 to 160x-120, but since we started the loop by doing that, there's no sense in going on.

Congratulations, your loop is complete. Start up your game, press Shift, and let your eyes bug out at the amazing scrolling planet. Don't watch it for too long though, could give you a headache.

I hope you all understand the basic principle: Basically you use two pictures. One you show in the screen, while the other waits right outside the screen. When scrolling starts, you move the first picture outside of the screen and the second one inside the screen. Then erase the first picture, put it in the right place, and do the same once again, but vica versa.

One last thing: Instead of the loop, you can also use Labels. To do this, just cut out all the code in the Loop part, make a Label and give it a number of your choosing, right beneath that put a Jump To Label and jump to your label number. In between those, paste the code from the loop. I think I heard that loops are commonly avoided because they're annoying to break, or something. Use whichever suits you best.

If you have any more questions or suggestions, let me know.


Pages: 1
Try to make something with a rain or snow graphic,
the difficult is made the correct area scroll fully
covered by the pictures
Pages: 1