Player Moving with Light (Help!)

lilMessy

Villager
Member
Joined
May 7, 2015
Messages
5
Reaction score
0
First Language
English
Primarily Uses
Hi,

I am new to the forums and new with RPG Maker VX Ace. I am currently working on an assignment and my partner suggested we should use RPG Maker and I agreed because I want to learn more about RPG Maker.

Anyway, we are currently stuck on a mechanic that we want to happen in the game. Let me set the scenario. It is in the city, at night (with light poles that are on) and cars passing by with the headlights on. The main character can only move then there is light, so to get from one light pole to the next, the player would have to walk with the car (that has the headlight on). I have also attacked an image for visual help.

Would it be possible to do it is a moving platform or is there another way to do it or is it impossible?

Lots of suggestions, advice and help would be appreciated.

Thanks,

lilMessy

help.png
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
How would you define "light" in this scenario?

Going with overlays, it could be possible to determine if the current screen position of the player has a non-black (aka lit) pixel in a light overlay.

By using Khas script (http://forums.rpgmakerweb.com/index.php?/topic/4917-khas-awesome-light-effects/), you can determine if a pixel is lit (see last page) and translate this to the player position.

It requires scripting and most likely won't be easy, but it should be possible.
 

lilMessy

Villager
Member
Joined
May 7, 2015
Messages
5
Reaction score
0
First Language
English
Primarily Uses
How would you define "light" in this scenario?

Going with overlays, it could be possible to determine if the current screen position of the player has a non-black (aka lit) pixel in a light overlay.

By using Khas script (http://forums.rpgmakerweb.com/index.php?/topic/4917-khas-awesome-light-effects/), you can determine if a pixel is lit (see last page) and translate this to the player position.

It requires scripting and most likely won't be easy, but it should be possible.
Hi Lavra,

Thanks for the reply. I will take a look at it and show my friend.

I want something like the file I attached.

As for light, I mean like a street lamp post.

lilMessy
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
The problem is something else - you need to define how the program would know where the light is and where not.


That could be something like "within three tiles of position XY" if the position XY is the lamp post - but if you say "only where the lamp post is" then you would have the actor jumping from one top of a lamppost to another only...


But the engine will never understand something like "where the light is", because for the engine there is nothing like "light" - you usually create the illusion of light to the player by placing overlays that are partially transparent (where the light is) and partially black pixels (where the dark is), but the engine cannot analyse those overlays to detect the tiles with light, you have to tell that in a different way.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Well, in theory you could take the player's center pixel (or multiple, but those of course mean more calculations), translate them to your overlay bitmaps and see if the color there is something else than [0, 0, 0, 255] (black). This would probably work ok for static light, like your lamp post, but could get very complicated with moving lights, like the cars.

I've done something similar to detect collision of bullets with walls. For my script, i stored the collision zones as a separate image (could have created them on map load via terrrain tags, but this way i could do collisions that weren't 32x32), loaded it with the map, translated the bullet positions to the bitmap and checked the pixel color there.
 
Last edited by a moderator:

lilMessy

Villager
Member
Joined
May 7, 2015
Messages
5
Reaction score
0
First Language
English
Primarily Uses
The problem is something else - you need to define how the program would know where the light is and where not.

That could be something like "within three tiles of position XY" if the position XY is the lamp post - but if you say "only where the lamp post is" then you would have the actor jumping from one top of a lamppost to another only...

But the engine will never understand something like "where the light is", because for the engine there is nothing like "light" - you usually create the illusion of light to the player by placing overlays that are partially transparent (where the light is) and partially black pixels (where the dark is), but the engine cannot analyse those overlays to detect the tiles with light, you have to tell that in a different way.
Thanks for the reply Andar.

I will test it will my friend today. Just wondering is it possible instead of using light from RPG Maker, what if the light was image tiles? and the player would have to move with these tiles. Would it be easier that way?

Well, in theory you could take the player's center pixel (or multiple, but those of course mean more calculations), translate them to your overlay bitmaps and see if the color there is something else than [0, 0, 0, 255] (black). This would probably work ok for static light, like your lamp post, but could get very complicated with moving lights, like the cars.

I've done something similar to detect collision of bullets with walls. For my script, i stored the collision zones as a separate image (could have created them on map load via terrrain tags, but this way i could do collisions that weren't 32x32), loaded it with the map, translated the bullet positions to the bitmap and checked the pixel color there.
Thanks for helping Lavra.

I will show this to my friend and see how it goes.

lilMessy
 

Udlice

Veteran
Veteran
Joined
Aug 16, 2014
Messages
54
Reaction score
11
First Language
French
Primarily Uses
Hello,

It is not possible to make the tiles moves. So you won't be hable to do the headlights that way.

Anyway, I found a good way to solve your problem.

It works with events and it's quite easy. You just check if the player is under the light poles by using regions Id and you check if he is under the headlights by checking theirs and the player position on the map.

Just see this demo.

https://www.dropbox.com/s/gj1ezlqeuoisstq/Player%20Moving%20with%20Light.exe?dl=0

Hope I helped.
 
Last edited by a moderator:

lilMessy

Villager
Member
Joined
May 7, 2015
Messages
5
Reaction score
0
First Language
English
Primarily Uses
Hello,

It is not possible to make the tiles moves. So you won't be hable to do the headlights that way.

Anyway, I found a good way to solve your problem.

It works with events and it's quite easy. You just check if the player is under the light poles by using regions Id and you check if he is under the headlights by checking theirs and the player position on the map.

Just see this demo.

https://www.dropbox.com/s/gj1ezlqeuoisstq/Player%20Moving%20with%20Light.exe?dl=0

Hope I helped.
OMG THIS HELP SO MUCH!!! THANK YOU!!!

We will also be crediting you in our assignment game.

Thanks so much,

lilMessy
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top