Want a flash light that darkens the screen and moves depending on the direction you are facing? Try these images! To use them, make a few simple event additions for any of these methods! When you get to the point in your method, where it is time to show the picture, instead, add in four new conditional branches. One for each player facing direction. In each conditional branch, place the corresponding show picture command!
This tutorial will use five different methods, I'm listing the different methods here at the top so you can find the one you want, and scroll to it's section below...Method I; Always showing the picture on particular maps.Method II; Requiring the player to have an item in their inventory to show the picture.Method III; Requiring the player to activate their item.Method IV; Requiring the player to hold a button to turn the light on.Method V; Requiring the player to press a button to turn the light on and off.
Alright, so there has been some confusion about this for quite some time. When I started with VX I too had some confusion and frustration! So I've decided it is time for an in depth tutorial that will show you several different options for this special effect.
First, we have our picture. This is just a simple image I created for my own uses, but there are a few different ones available on this site and others. Most are fairly similar as they all employ the same idea.
Go ahead and save that and import it to your "Pictures" folder in your project.Method I; Always showing the picture on particular maps.
Now, our first method is going to just be a simple test to make this image appear on our player, and follow their movements.
Go ahead and create a new event on whichever map you would like this effect. It's best if this event is out of the way somewhere, say in a wall, or unpassable tile, just in case. Give it a parallel process trigger. Now for our first entry in this event we need to set some variables. For this method we will be using two very simple variables (which are often used for other events in games anyways, so you may already have them!). First we need to create a variable, let's call it "Player's X", and we want to set this variable to the Player's Screen X, like so...
We then need to make a second variable for the Y axis...
Now that we have our variables, we can move on to the next entry in our event which is a simple "Show picture" command, like this...
Note we have given the picture the X and Y position of the two X and Y variables we created. This will put the picture directly over our player. Also, we have applied the "Center" option, so our spotlight will appear in the appropriate place above our player.
Go ahead and test it out. Whenever you start on that map, this graphic will be shown. Just for precaution when you are using this method, whenever you want to leave the map through a transfer event, be sure to add an "Erase Picture" command, so the picture will not show on your next map.Method II; Requiring the player to have an item in their inventory to show the picture.
This method is very similar to the first, so we are going to assume you know how to create and control variables, and use show picture commands.
The only real difference in this method is that we are going to first (in the same event, above all other commands) tint the screen pitch black, like so...
Now, I usually add a text command to let the player know that they need an item to be able to see on this map, but that is completely up to you.
Now we need to create our item!
Simple enough, the price can be whatever you want, make sure your player cannot use the item and it is not consumed. It's really just a ghost item that you cannot use!
Since we have created our item, we can now create a conditional branch in our torch event like so...
This event now checks if our player has the needed item, and then shows the picture appropriately. Also note that we have added in our "else" section, commands that will remove the picture and tint the screen to black if for any reason, the torch is removed from the player's inventory. You probably don't need this else statement but just in case... Method III; Requiring the player to activate their item.
Alright, so now you know how to use conditional branches, variables, show picture commands, and screen tint! You're learning something new every day! Huzzah! Ok, moving on.
So sometimes we want a little control over our game, which introduces us to our third method.
We are this time, going to go back and edit the item we created earlier, this time, we want it to call a common event and only be able to use it from the menu. Now for the common event we want to call...
And our map event...
Simple right? Now our player has to use the torch to turn the light on, and when they use the torch again, the light is turned off! Again for precaution, in your transfer events, turn the torch switch off, and set the map tint to whatever you would like.Method IV; Requiring the player to hold a button to turn the light on.
This method is going to use a button press from the player to turn the light on. When they aren't holding the button, the light will go out.
Be sure to check what buttons are assigned to what letters in your game by pressing F1 while you are in test play, and checking the keyboard configuration. Try to set the button you would like to a key that isn't normally used through the rest of your project. I have it set to use the shift key, as our X button. This method is tested and does work, but if you are having problems with it, double check your settings before complaining!
Now this event doesn't require the player to have the item in their inventory. To do that, we add another simple conditional branch like so...
Now the player has to have the torch in their inventory to use the button press command!
Awesome for instantaneous use of the torch effect! Although, some players may experience some discomfort from holding the button for lengthy dungeons, so this will lead us to our final method!Method V; Requiring the player to press a button to turn the light on and off.
This is my favorite method. We just need to make some simple edits to method four to get this one to work appropriately.
This event has two pages now, here is our first page...
And our second page...
These events simply check if our button is pressed, turns the image process on, and then waits silently for another button press to turn the image process off.
If we want the player to have to have the torch in the inventory, we just have to edit the first page like so...
Now the player cannot turn on the torch unless they have it! Whoo!
Well guys it's been fun, and now you have all the knowledge you will need to create your event! Feel free to edit any of the variable names, switch names, item names, etc, to whatever you would like for your game.
Please let me know if you found this tutorial helpful, and vote for your favorite method in the poll above!
Good luck with your games, guys.
Signed with love,
This post has been edited by VIII: Jul 4 2009, 07:14 AM