11 10 / 2016

Simple screen panning system in RPG Maker 2003It uses a single common event which runs in the background, so it’s cheap to process and maps can be huge at no extra cost.
The common event simply checks the players location once every loop. It also has...

Simple screen panning system in RPG Maker 2003

It uses a single common event which runs in the background, so it’s cheap to process and maps can be huge at no extra cost.

The common event simply checks the players location once every loop. It also has stored the world-space coordinates of the screen edges.

If the player’s location exceeds any of these edges it pans the camera, then moves the boundaries to reflect the new camera position. That’s it!


Benefits of this system

Compare this system to having the player step on invisible map event tiles which trigger the screen pan: RPG Maker 2003 really starts to chug if you add lots of map events, so having lots of these tiles lining the borders of every screen would be very expensive performance-wise. My system uses only one common event, and it requires no extra event work to increase the map size.


How to do it

Just create a new Common Event with the following setup:

image

Note: The sample script above only handles horizontal movement, but you’d just need to copy and paste the 2 conditional branches and change them to use the Y coordinates and move the screen and player up/down instead of left/right.

You’ll also need to do some initialisation to get it set up properly.

Call this common event once when you want the camera behaviour to start:

image

This stops the camera from following the player character in the usual 1:1 way, so it will be controlled entirely by the common event above.

It also defines the location of the screen boundaries at the very start. This depends on a) your map size and b) where abouts your player starts. I’m still figuring that out for my map, so I’ve thrown in some placeholder numbers.

The important thing is the the min & max for both X and Y span the width of your screen size (RPG Maker 2003′s default is 20x15, but you might want to make them bigger or smaller to suit your design).

The switch that’s activated at the end just allows the common event to run (see that it’s the condition in the main common event loop). If you ever want to revert back to normal camera movement you can just turn off that switch and unfix the camera scrolling.

Feel free to mess around with this and come up with your own twists on it :)

@crowbarska

  1. shitthatinspires reblogged this from ponett
  2. lahat-refs reblogged this from pinkuboa
  3. b0rntobebeheaded reblogged this from pinkuboa
  4. duwango reblogged this from mystery845
  5. itmeultimate reblogged this from bunnysharks
  6. rpgtemp reblogged this from crowbarska
  7. happi-iris reblogged this from bunnysharks
  8. xantavia reblogged this from bunnysharks
  9. comaatoasty reblogged this from ominashii
  10. crowbarska posted this