The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: Yawgmothsbud on June 01, 2007, 04:31:27 AM

Title: [RESOLVED] Picture Location Limitations
Post by: Yawgmothsbud on June 01, 2007, 04:31:27 AM
The title is kind of a fancy way of explaining my problem. More simply, I'm trying to add a picture that consists of a circular gradient and creates a "torch" effect, giving the player only a small window of the map.
The problem is that it only stays centered on your sprite as long as you stay away from the edges of the map: as soon as you the edge of your screen touches the edge of the map, the picture stops moving in that direction, and you move out of the circle of "light".

I've been working on this problem with events for awhile now, and I'm getting nowhere. Any ideas?
Title: Re: Picture Location Limitations
Post by: modern algebra on June 01, 2007, 05:34:15 AM
You'll need to do a little bit of frigging around to determine the right setting, but if you base picture location on variables then it will work. Specifically, set the variables to the player's screen x and screen y. You will need to subtract a bit from those variables in order to center the picture on the player, but once you figure that out (prolly subtract half the width of the picture from the x and half the height of the picture from the y), you'll be golden.
Title: Re: Picture Location Limitations
Post by: Zeriab on June 01, 2007, 09:24:05 AM
It would be easier if you just increased the map size and put some impassable stuff around the edges so the player will always stay dead center.
Title: Re: Picture Location Limitations
Post by: modern algebra on June 01, 2007, 08:15:20 PM
That kind of sounds much more annoying <3. I think my way works well. If you put it on center it works even better.
Title: Re: Picture Location Limitations
Post by: Yawgmothsbud on June 02, 2007, 03:17:26 AM
Centering it is actually the easy part. You're right, Algebra, I had been using the players X and Y coordinates to determine the picture location. However, this stops working when you approach the edge of the map. So far, Zeriab's solution is all I had been able to think of, and I was hoping there was a better way.
Title: Re: Picture Location Limitations
Post by: modern algebra on June 02, 2007, 04:06:51 AM
Don't use Map X and Map Y. Use Screen X and Screen Y

EDIT:
Like this demo:

Title: Re: Picture Location Limitations
Post by: Yawgmothsbud on June 02, 2007, 04:04:16 PM
Thanks Modern Algebra. Once again you have saved me from endless frustration :D