Hey everybody,
this tutorial is very similar to my Light tutorial, but can be used as a flashlight.
This tutorial is quite long@_@, so bear with me.:yes:
Basically what this tutorial does, is makes it so if you have an item (such as a flashlight), you can toggle a flashlight by pressing the shift button.
Ok! Let's get started:
Just like my other tutorial, this one uses this picture. save it in your pictures folder:
http://i156.photobucket.com/albums/t1/A ... /light.png[/IMG]
Make SURE when you import it you clear the transparencies:
http://i156.photobucket.com/albums/t1/A ... Import.jpg[/IMG]
Ok. Create an Autostart event, create a "Switch: On" command and call the switch "Start", then an "Erase Event" command like this:
http://i156.photobucket.com/albums/t1/A ... hevent.jpg[/IMG]
This is to automatically start the common events that we will create next.
Now go to the database and create a common event called "Hero Screen X/Y" and set it to parallel process, with "Start" as its trigger switch.
inside this common event, create two variables called "X" and "Y".
(those of you who have seen my Light tutorial know where this is going :P)
it should look like this:
http://i156.photobucket.com/albums/t1/A ... oxandy.jpg[/IMG]
and set them to record the SCREEN X and Y. this is crucial.
Next, create another Common event called "Flashlight switch", set it to parallel process and have "Start" trigger it. Now for a whole bunch of Contitional branch commands :P. Just do this:
http://i156.photobucket.com/albums/t1/A ... switch.jpg[/IMG]
("Key A" is Shift. you can alter this to any button you want. I think there is a Keyboard script or two out there. :P)
Show Picture command:
I made the picture command like this:
http://i156.photobucket.com/albums/t1/A ... hlight.jpg[/IMG]
Now create a 3rd common event called "Flashlight", and make it set to parallel process with the "Flashlight" switch you just created as its trigger.
Make four conditional branches separate from eachother with no else handler options, one for each facing direction.
Inside put a variable command, altering either "X" or "Y" (Just play around with the values until it looks right for you. I used these). this is to make the light be not directly on the hero.
http://i156.photobucket.com/albums/t1/A ... hlight.jpg[/IMG]
Move Picture command (Facing Left and Right):
when the player is facing left and right, make the command look like this:
http://i156.photobucket.com/albums/t1/A ... dright.jpg[/IMG]
Move Picture command (Facing Up and Down):
when the player is facing up and down, make the command look like this:
http://i156.photobucket.com/albums/t1/A ... nddown.jpg[/IMG]
These may look the exact same, but the only difference is the magnification values are reversed.
and finally at the end of each conditional branch, add a wait command of 1 frame, and we're done!
You should have something that looks similar to this:
http://i156.photobucket.com/albums/t1/A ... roduct.jpg[/IMG]
Good luck on your projects everyone, I hope this helped. Also, I'd like to know if you guys have any Questions, Comments or Criticisms.:thumb:
Thanks,
-Angelman
this tutorial is very similar to my Light tutorial, but can be used as a flashlight.
This tutorial is quite long@_@, so bear with me.:yes:
Basically what this tutorial does, is makes it so if you have an item (such as a flashlight), you can toggle a flashlight by pressing the shift button.
Ok! Let's get started:
Just like my other tutorial, this one uses this picture. save it in your pictures folder:
http://i156.photobucket.com/albums/t1/A ... /light.png[/IMG]
Make SURE when you import it you clear the transparencies:
http://i156.photobucket.com/albums/t1/A ... Import.jpg[/IMG]
Ok. Create an Autostart event, create a "Switch: On" command and call the switch "Start", then an "Erase Event" command like this:
http://i156.photobucket.com/albums/t1/A ... hevent.jpg[/IMG]
This is to automatically start the common events that we will create next.
Now go to the database and create a common event called "Hero Screen X/Y" and set it to parallel process, with "Start" as its trigger switch.
inside this common event, create two variables called "X" and "Y".
(those of you who have seen my Light tutorial know where this is going :P)
it should look like this:
http://i156.photobucket.com/albums/t1/A ... oxandy.jpg[/IMG]
and set them to record the SCREEN X and Y. this is crucial.
Next, create another Common event called "Flashlight switch", set it to parallel process and have "Start" trigger it. Now for a whole bunch of Contitional branch commands :P. Just do this:
http://i156.photobucket.com/albums/t1/A ... switch.jpg[/IMG]
("Key A" is Shift. you can alter this to any button you want. I think there is a Keyboard script or two out there. :P)
Show Picture command:
I made the picture command like this:
http://i156.photobucket.com/albums/t1/A ... hlight.jpg[/IMG]
Now create a 3rd common event called "Flashlight", and make it set to parallel process with the "Flashlight" switch you just created as its trigger.
Make four conditional branches separate from eachother with no else handler options, one for each facing direction.
Inside put a variable command, altering either "X" or "Y" (Just play around with the values until it looks right for you. I used these). this is to make the light be not directly on the hero.
http://i156.photobucket.com/albums/t1/A ... hlight.jpg[/IMG]
Move Picture command (Facing Left and Right):
when the player is facing left and right, make the command look like this:
http://i156.photobucket.com/albums/t1/A ... dright.jpg[/IMG]
Move Picture command (Facing Up and Down):
when the player is facing up and down, make the command look like this:
http://i156.photobucket.com/albums/t1/A ... nddown.jpg[/IMG]
These may look the exact same, but the only difference is the magnification values are reversed.
and finally at the end of each conditional branch, add a wait command of 1 frame, and we're done!
You should have something that looks similar to this:
http://i156.photobucket.com/albums/t1/A ... roduct.jpg[/IMG]
Good luck on your projects everyone, I hope this helped. Also, I'd like to know if you guys have any Questions, Comments or Criticisms.:thumb:
Thanks,
-Angelman