[RM2K3] DELAYED OVERLAY SCROLLING

Posts

Pages: 1
Hello pals! Although I've been using RM2k3 for a very long time, I don't use pictures very often and don't know much about them. I've run into a problem that I think has a very simple solution I'm just not getting.

I want to show an overlay (in this instance, a canopy of leaves), but I want it to scroll at a different speed than the player (slightly slower) to give the effect of depth. The map is a set size- 30x20. There isn't very much scrolling as a result, but I want to show a few pixels of movement and perhaps use the same trick on a larger map, as well. What's the easiest way to do this?
I ran into a similar problem when I was working on that YS3 thing that no one played - I wanted to make fake parallax scrolling through very simple means in rpgmaker2003 - DHM and Cherry, I think, provided the solution through:

You need to use variables to assign the coordinates of the picture.

But, figuring out how to make the picture behave in relation to the players movements - I haven't figured out that part yet.


EDIT: I tried fooling around with it a bit for a few minutes:
-You need to create two variables: Call them "Player X" and "Player Y"
-You need to use the "Get Player Location" Command to record the players current location to these variables.
-(Some sort of Math Equation involving the Pictures location in relation to the players current coordinates.)
-Use The Move Picture Command, but instead assigning coordinates, assign it to the "Player X" and "Player Y" variables.


...Someone who has a better grasp of it, will probably be able to explain it better than I can, but it's a start.
I've used Pictures extensively and I can help.

LordBlueRouge is correct. You should run a Parallel Process that scrolls the pictures every time the player moves according to whether Player X or Player Y is different:

1. First, record the current Player X and Player Y coordinates. You can do this in the Variable Operations's "Other" field, I think.
2. Every time the player takes a step, record those new coordinates. You can just do this with another parallel process that is setting another Player X and Player Y variable pair. If they're different from Player X and Player Y that you set in the variables before, then the player has moved. (This is also how you make a custom encounter system.)
3. See how the current Player X/Player Y, the ones you just set, are different from the first ones you set. For example, is the new X bigger or smaller? Then the player has moved horizontally.
4. Call an event page which now moves the canopy according to how the player's coordinates have changed. Set movement to occur over something like .5 seconds—this will make the movement smooth. (If the player is dashing or something, you can decrease the amount of time.) But DON'T check "Wait for completion", so events can still occur.
I got into the practice of always tracking player X/Y at all times for lots of reasons early on, so I have those variables set (although I might reset them here to new variables for ease of mathematics), but I'm a bit confused about that last step.

What exactly am I doing with the Move Picture command? By what number do I change the variable? If I'm understanding your explanation correctly, the end result will be that the overlay stays in position over the player's head, but lags behind him a little bit- what I'm interested in doing is to make the overlay move at a different speed AND end up in a slightly different position. Sort of like how panoramas can scroll at different speed than the foreground to give the illusion of depth.
For this you need a tiled overlay, or a gigantic overlay that can cover the entire map. It's kind of complicated.

For one gigantic image, you should scroll the screen to the appropriate place when you load the map, place the image, then scroll back. It has to be pretty big to account for the player standing at the extreme edges of the map, and also depending on whether this image scrolls faster or slower than the speed at which the map moves under the player as he or she walks.

For the tiled images, you need to have not one, but 9 images, all the same. When the player moves, you move all of them in the same direction, opposite of the player's movement. You need nine to account for the player revealing the overlay that's currently off the screen. Then, when the player moves the tiles so far off the screen that you're going to run out of tiles, you have to move those farthest tiles back around to the fore.

what I'm interested in doing is to make the overlay move at a different speed AND end up in a slightly different position. Sort of like how panoramas can scroll at different speed than the foreground to give the illusion of depth.

Kaempfer is this what you meant? (The Tree in the foreground) Let me know and I'll give you the quick gist of it.



(I threw this together in 10 mins, cause I've always wanted to figure out how to do picture parallax scrolling as well - this only moves left and right though, not up and down)
@Mr. Braun:
This particular map is very small (30x20 tiles) and you can't scroll around it. Your solution seems to account for a much larger map with edge scrolling, no? I'm also not sure the precise mathematics for actually delaying the overlay itself, which is more the problem.

@LBR:
That is exactly what I want, yeah! I mean, not exactly, I'm not making a Ys game, but very similar.
In that case, the case for binding the overlay to the player but with slower movement:

Normally, if you were making the overlay move in exact relation to the player, you'd make it move 16 pixels in the opposite direction that the player is moving every time that the player takes a step. (Because a single tile is 16 pixels.) You would do this over, say, 0.3 seconds (depends on how fast the player's speed is set).

For what you describe, you simply decrease the amount that the overlay moves, and possibly, how fast it moves. (This might give it a kind of ghostly movement though, not entirely in step with the player. You'd have to find the right transition duration amount.) So, for half player movement, you would just move the overlay 8 pixels. There's no hard rule about how far you'd have to move the overlay, so you could experiment with it.
author=Kaempfer
@LBR:
That is exactly what I want, yeah! I mean, not exactly, I'm not making a Ys game, but very similar.

Yeah yeah yeah, no worries ♥!

you may also want to download Image Positioner, for using the Show Picture Command and planning out where the overlay will show up on your screen, for the more complicated spots.


So here's the quick and dirty version of it: (I just learned this yesterday so it's far from perfect, so i'm hoping someone will be able to fine tune this.)
What you need is:

1 Picture,
6 variables
and 3 events.

Your Picture is: your Overlay
Your 6 Variables are:
Hero X,
Hero Y,
Current Pos X,
Current Pos Y
Overlay X,
Overlay Y

*don't make any of the variables 0001 - you'll get errors; it gets funky.

On the First Event:
Parallel Process:
Memorize Location/Get Player Position
Map ID: Leave blank
Store X Coordinate in: Hero X,
Store Y Coordinate in: Hero Y,
(This is to record your hero's coordinates)

On the Second Event:
Parallel Process:
Variable Operation: Current Pos X, Set Equal to, Hero X
Variable Operation: Current Pos Y, Set Equal to, Hero Y
(This is for the Overlay to react to your hero's coordinates)
Show Picture: (Put in your Overlay)(write down the X,Y coordinates it's set to) i.e. (160,120)
Variable Operation: Overlay X, Set Equal to (Type in The X Coordinates you placed in Show Picture)(i.e. write down 160)
Variable Operation: Overlay Y, Set Equal to (Type in The Y Coordinates you placed in Show Picture)(i.e. write down 120)
Erase Event.

On the Third Event:
Parallel Process:
(This is for when your Hero moves Left)
Branch Condition: If Hero X is Greater than Current Pos X (no customer handle)
Variable Operation: Set Overlay X to -2
Move Picture to - Variable Reference: Overlay X, Overlay Y 0.1 Sec
Variable Operation: Current Position X, Set Equal to, Hero X

(This is for when your Hero moves Right)
Branch Condition: If Hero X is Lesser than Current Pos X (no customer handle)
Variable Operation: Set Overlay X to +2
Move Picture to - Variable Reference: Overlay X, Overlay Y 0.1 Sec
Variable Operation: Current Position X, Set Equal to, Hero X

(This is for when your Hero moves Up)

Branch Condition: If Hero Y is Greater than Current Pos Y (no customer handle)
Variable Operation: Set Overlay Y to -2
Move Picture to - Variable Reference: Overlay X, Overlay Y 0.1 Sec
Variable Operation: Current Position Y, Set Equal to, Hero Y

(This is for when your Hero moves Down)
Branch Condition: If Hero Y is Lesser than Current Pos Y (no customer handle)
Variable Operation: Set Overlay Y to +2
Move Picture to - Variable Reference: Overlay X, Overlay Y 0.1 Sec
Variable Operation: Current Position Y, Set Equal to, Hero Y

(Now try it out and see if it works!)

Now, If you want to adjust the speed of the picture:
Set variable to: _* Move Picture Time: 0.2 Sec = fast (anything above five)
Set variable to: 4 Move Picture Time: 0.1 Sec = normal
Set variable to: 2 Move Picture Time: 0.1 Sec = slow (what it's set at right now)
Set variable to: 1 Move Picture Time: 0.0 Sec = slowest

Play around with the speeds. I think variable 4 and picture speed 0.1 sec might be what you're looking for. But similar to how RPGMaker2003 treats Movement Frequency and Movement Speed - deviating between these settings; picture movement will look kind of choppy.

But yeah, Try this out, and let me know if this works; Worse comes to worse, I'll take a picture of each event page and upload them here, for a clearer explanation, but yeah, this is pretty much the gist of it.
@LBR:
I tried your version and, while it works somewhat it doesn't work... well in this map. I'm pretty sure I've got everything setup correctly, but no matter what I set the move distance to or the picture move speed it looks extremely janky. Like, it kind of moves all over the place when the player moves on any kind of diagonal (left then up for example, not true diagonal) it sort of works so long as the player restricts his movement to a single axis, but even then it will suddenly jump 16 pixels or so. I'm not what's causing it, but this is verging on "too much work for an effect I'll use on two maps".

@Braun:
I think your instructions mirrored BlueRouge's, but I can't seem to get this to work.
@LBR:
I tried your version and, while it works somewhat it doesn't work... well in this map. I'm pretty sure I've got everything setup correctly, but no matter what I set the move distance to or the picture move speed it looks extremely janky. Like, it kind of moves all over the place when the player moves on any kind of diagonal (left then up for example, not true diagonal) it sort of works so long as the player restricts his movement to a single axis, but even then it will suddenly jump 16 pixels or so. I'm not what's causing it, but this is verging on "too much work for an effect I'll use on two maps".


Ahhh... (╥﹏╥) that's too bad. I wanted to upload these examples today, just to see if this was the effect you were trying to go for:
(uploaded in 60fps for performance purposes)




...And if you add additional pictures you can kind of experiment with it:




Is there a particular game you're trying emulate this effect from, Kaempfer?
Is it like The Lost Woods in LOZ:A Link to the Past after you pull out the mastersword?:



@2:20 in this vid - where the tree/shade overlay kind of "floats" overhead as the player moves?
Hi,

Sorry for the delay, I haven't been able to get to a computer that could upload to RMN in a day.

I made a simple test game to showcase this function. I found that the values, such as the duration of the picture movement, have to be precise, in order to prevent the appearance of stuttering movement. Open this up in your RPG Maker 2003 and look around. I made this in the tsukuru version, but it should still carry over.

https://rpgmaker.net/users/Zachary_Braun/locker/Overlay.zip

When you move to the edges of the map, the overlay scrolls off a bit, so you can see how it moves in respect to the map tiles. (In order to prevent this, just make the overlay larger. Currently, it's the exact size of the map, 480 x 320.
@LBR/Zachary:
Thanks for all your help, but it seems like I am too stupid to apply this. I copied Zachary's test events by hand and ended up with the same issue as I faced when I copied LBR's events: totally not at all smooth stuttery movement. Since in both LBR's videos and Zachary's test project the movement is correct and smooth, I am obviously doing something wrong, but I can't figure out what it is.

I'm giving up on this little experiment. Again, thanks for all your help, and sorry for wasting your time, I know you guys put a lot of effort into trying to solve this issue for me.
Pages: 1