|
Home > Tutorials > RPG Maker 2003 > Chargeable Kamehameha
Chargeable Kamehameha
Have you ever wanted to be able to charge a projectile to make it stronger, before you fire it? Well now you can! First we're going to need some variable and switches.
Variables:
1-Hero MP
2-Hero Power (this is the projectiles starting damage)
3-Hero X
4-Hero Y
5-Input Key
6-Enemy X
7-Enemy Y
8-Enemy HP
Switches:
1-Charging
2-Shooting
Step 1: Making the Common Events
First thing we have to do is make the common events. We'll need five common events.
1-Kamehameha System |Parallel Process| (the projectile will be called Kamehameha in this tutorial)
2-Charging Anim. |Parallel Process-[0001-Charging]|
3-Shooting Anim. |Parallel Process-[0002-Shooting]|
4-Release Kamehameha |Call|
5-Damage Set |Call|
Once you've made them, we're ready to set up the first C.E. (common event).
1- Make a Key Input Processing Event. Make it input into [0005-Input Key], and uncheck "Wait until key hit" box. Uncheck everything except the Decision key [5].
2- Make a Conditional Branch. This branch will check if [0005] is equal to 5.
3- Wait 0.2 seconds to kill lag.
4- Make another Key Input Processing event. Same as before exactly.
5- Make the same branch as before after this key input event. The double branches determine if you're holding or tapping the Z/Enter Key.
6- Inside the second branch you'll have to make the hero wait. Go to Move Event and make the hero wait.
7- Change to graphic of the hero to the first charging animation.
8- Call the CE "Damage Set".
9- Make a loop. Just find "Loop" on the third page of event commands and click it.
10- Inside the loop, make it wait 0.0 seconds to kill lag.
11- Then make yet another Key Input Processing Event identical to the first two.
12- Now make another conditional branch, but this time, to check if [0005] = 0.
13- Inside that branch, call the event "Release Kamehameha".
14- Now break loop
15- Find the "Else handler for the second branch we did.
16- Now set [0001-Hero MP] = 5. (Or whatever, that's the starting damage for me)
17- Call event "Release Kamehameha"
The code will look like this:
<>Key Input [0005]
<>Branch if Var [0001] = 5
__<>Wait 0.2 sec
__<>Key Input [0005]
__<>Branch if Var [0001] = 5
____<>Move Event: Hero, Wait
____<>Change Sprite Assoc. - Hero - 1st Charge Animation
____<>Call Event: Damage Set
____<>Loop
______<>Wait 0.0 sec
______<>Key Input [0005]
______<>Branch if Var [0005] = 0
________<>Call Event: Release Kamehameha
________<>Break Loop
________<>
______: Else Handler
________<>
______: End
______<>
____: End Loop
____<>
__: Else Handler
____<>Variable Operations [0005] Set = 5
____<>Call Event: Release Kamehameha
____<>
__: End
__<>
: Else Handler
__<>
: End
<>
Now we're on to the event "Charging Animation".
1-Conditional Branch. Check if [0001] less than or equal to 20.
2- In the branch, make hero wait 2 times.
3- Change hero's graphic to second charging animation.
4- Wait 0.1 sec
5- [0002-Hero Power] + 1
6- Change graphic back to first charging animation.
7- Wait 0.1
8- [0002-Hero Power] + 1
9- In the else handler of this branch, make another branch that checks if [0002] is greater than or equal to 20.
10- In that branch make the hero wait 2 times.
11- Change graphic to second powerful charging animation.
12- wait 0.1 sec
13- [0002] + 1
14- change graphic to first powerful charging animation.
15- Wait 0.1 sec
16- [0002] + 1
That's the end of that one. Here's what the code will look like:
<>Branch if Var [0002] is 20 Less/Equal
__<>Move Event: Hero, Wait, Wait
__<>Change Sprite Association - Hero - 2nd Charge Sprite
__<>Wait 0.1 sec
__<>Variable Operations [0002] +1
__<>Change Sprite Association - Hero - 1st Charge Sprite
__<>Wait 0.1 sec
__<>Variable Operations [0002] +1
__<>
: Else Handler
__<>Branch if Var [0002] is 20 or more
____<>Move Event: Hero, Wait, Wait
____<>Change Sprite Assoc. - Hero - 2nd Charge Sprite
____<>Wait 0.1 sec
____<>Variable Operations [0002] +1
____<>Change Sprite Assoc. - Hero - 1st Charge Sprite
____<>Wait 0.1 sec
____<>Variable Operations [0002] +1
____<>
__: Else Handler
____<>
__: End
__<>
: End
<>
Let's go to the Shooting Animation Event.
1- Make the hero wait here
2- Change the graphic to the first shooting animation
3- Wait 0.1 sec
4- Change to the second shoot animation
5- Wait 0.1 sec
The code:
<>Move Event: Hero, Wait
<>Change Sprite Assoc. -Hero -1st Shooting Anim.
<>Wait 0.1 sec
<>Change Sprite Assoc. -Hero -2nd Shooting Anim.
Now to the Release Kamehameha Event.
1- Turn off [0001-Charging] switch
2- Turn on the [0002-Shooting] Switch
4- make hero wait two times.
5- conditional branch if the hero is facing up
6 inside here, another branch to see if var [0002] less than or equal to 20.
7- Show the Animation for the Weak Kamehameha Facing Up, check the halt other processes box.
8- Turn off [0002] switch
9- Change hero's sprite back to idle.
10- set variable [0002] = 0
11- in the else handler, make another branch to check if the var [0002] is greater than 20.
12- Show the battle animation for the Strong Kamehameha Facing Up, check the halt other processes box.
13- turn off [0002] switch
14- change hero's sprite back to idle
15- set var [0002] =0
16- Repeat for other directions.
The code:
<>Switch [0001] off
<>Switch [0002] on
<>Move Event: Hero, Wait, Wait
<>Branch if Hero Facing Up
__<>Branch if var [0002] is 20 Less/Equal
____<>Show Animation [Weak Kame Up]
____<>Switch [0002] off
____<>Change Sprite Assoc. -Hero -Idle Sprite
____<> Variable Oper. [0002] = 0
__: Else Handler
____<>Branch if var [0002] is 20 greater
______<>Show Animation [Strong Kame Up]
______<>Switch [0002] off
______<>Change Sprite Assoc. -Hero -Idle Sprite
______<>Variable Oper. [0002] = 0
____: Else Handler
______<>
____: End
____<>
__: End
__<>
: End
<>Repeat for other directions.
Now the Damage Set event.
1- Set [0002] equal to five.
2- turn [0001] switch on
Code:
<>Variable Oper. [0002] = 5
<>Switch [0001] On
<>
And that's it! Test it out, it should work perfectly! Thanks for reading!
|
|
Details
|
|
Tutorial:
|
Chargeable Kamehameha |
|
Date Listed:
|
2009-08-17 |
|
Author:
|
SoraX
|
|
Total Hits:
|
2675 |
|
|
|