Post by rcrmaker on Oct 29, 2005 15:26:18 GMT -5
Hi, in this tutorial, I am going to be showing you all how to have blood effects when you or an enemy is shot...
. Let's recall to reality, if you are shot, you bleed obviously. But unlike most games out there, your blood will of course stay on the floor in the area you were shot... this tutorial shows you how to make one of those systems...
You will need an understanding ofthe following:
- Variables (and Manipulating co-ordinates with them.)
- Switches
- A blood CHARACTER SET - NO BATTLE ANIMATIONS!
First off, you will need your ABS setup. (It's worth noting that your ABS must be ready before attempting this tutorial.)
Okay, so there are so many ABS systems out there, but I am following Ataris "Shooting and hearing". Those tuts are a great series that should be used.
So you have your ABS ready. Now, go to whichever line contains the code for what happens when the enemy is hit with a bullet. It will contain something like:
Var:xxx: Enemy1HP - 1
Now, under that code for decreasing enemy HPor whatever else you have plotted under the enemy is hit section, comes your blood system. Enter a comment: BLOOD SYSTEM before you start. Now everything under this comment will be your blood system.
Now get out of that event (Don't forget to hit apply!!!)
and make some new events. These event graphics should betheblood graphics that you SHOULD already have. You can make as many of these as you want. Name the events as follows: Blood1, Blood2, etc... down to whatever number of blood events you want available. Place these events inthe corner of your screen, where they cannot be touched suring the game. The events should be BELOW HERO. For each event you have created, create a switch corresponding to the event number (okay that sounds complicated...)
i.e. The event Blood1, will have a switch "Blood1on" and so on. When you are done with this, itis time for the final piece of coding...
Basically, when the enemy is hit, you want to make a blood event appear underneath him to simulate blood loss. To do this we use the "Change event location" command. As with any ABS, you need to calculate the co-ordinates of the enemy's map position, so you need to have coordinates - EnemyX and EnemyY, or something similar. Now, underyour Comment you placed:Change event: Blood1 location: EnemyX,EnemyY. Switch: Blood1 ON.
What this does is moves the bloodevent directly under the enemy. It then activates the event switch so the blood can be seen. Give it a test try.
Oh dear, it seems there are one or two bugs?
after all, how the hell does the system know which blood event to use? Blood event1 will just dissapear from its own location and appear under a new location...and we don't want that. There is a simple way to fix it.
You have to tell the system that whenever a switch is activated, then it means that event is already in use and that it should go and try another blood event.
We use the following code:
IF Switch Blood1 is off
change event location: blood1: EnemyX, EnemyY
Switch Blood1 ON
Else
IF Switch Blood2 is off
change event location: blood2: EnemyX, EnemyY
Switch Blood2 ON
etc... and you would repeat the above steps with all f the blood events you have. (You can have as many as you want).
What this piece of code does is tells the system to check whether blood event1 is active, if it isn't, it will use it and turn blood switch 1 on. If it was already ative to begin with (The enemy has already been shot and blood event1 is already on the floor somewhere.) it will go through and check until it finds an event which hasn't been used. If it finds no events to use, it will not display any blood of course. NB: You will have to turn off all blood switches in the teleport event to leave the map. This is because the events are reset when you leave the map. There are ways around this, which I will talk about in Part 2.
Anyway, I hope you have been enlightened by this tutorial, and if you didn't understand any of my babble, here is the code, ignore the bracketed parts. (This code shows an example for five blood events).
(CODE FOR ABS)
(ENEMY HAS BEEN SHOT CODE)
<>COMMENT: BLOOD SYSTEM
<>Show battle animation: blood,Enemy1 (optional)
<> Branch IF Switch Blood1 is OFF
<> Change Event Location: Blood1 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood1] ON
<> Else Handler
<> Branch IF Switch Blood2 is OFF
<> Change Event Location: Blood2 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood2] ON
<> Else Handler
<> Branch IF Switch Blood3 is OFF
<> Change Event Location: Blood3 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood3] ON
<> Else Handler
<> Branch IF Switch Blood3 is OFF
<> Change Event Location: Blood3 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood3] ON
<> Else Handler
<> Branch IF Switch Blood4 is OFF
<> Change Event Location: Blood4 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood4] ON
<> Else Handler
<> Branch IF Switch Blood5 is OFF
<> Change Event Location: Blood5 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood5] ON
<> Else Handler
-- Enjoy!! -- ;D
. Let's recall to reality, if you are shot, you bleed obviously. But unlike most games out there, your blood will of course stay on the floor in the area you were shot... this tutorial shows you how to make one of those systems...
You will need an understanding ofthe following:
- Variables (and Manipulating co-ordinates with them.)
- Switches
- A blood CHARACTER SET - NO BATTLE ANIMATIONS!
First off, you will need your ABS setup. (It's worth noting that your ABS must be ready before attempting this tutorial.)
Okay, so there are so many ABS systems out there, but I am following Ataris "Shooting and hearing". Those tuts are a great series that should be used.
So you have your ABS ready. Now, go to whichever line contains the code for what happens when the enemy is hit with a bullet. It will contain something like:
Var:xxx: Enemy1HP - 1
Now, under that code for decreasing enemy HPor whatever else you have plotted under the enemy is hit section, comes your blood system. Enter a comment: BLOOD SYSTEM before you start. Now everything under this comment will be your blood system.
Now get out of that event (Don't forget to hit apply!!!)
and make some new events. These event graphics should betheblood graphics that you SHOULD already have. You can make as many of these as you want. Name the events as follows: Blood1, Blood2, etc... down to whatever number of blood events you want available. Place these events inthe corner of your screen, where they cannot be touched suring the game. The events should be BELOW HERO. For each event you have created, create a switch corresponding to the event number (okay that sounds complicated...)
i.e. The event Blood1, will have a switch "Blood1on" and so on. When you are done with this, itis time for the final piece of coding...
Basically, when the enemy is hit, you want to make a blood event appear underneath him to simulate blood loss. To do this we use the "Change event location" command. As with any ABS, you need to calculate the co-ordinates of the enemy's map position, so you need to have coordinates - EnemyX and EnemyY, or something similar. Now, underyour Comment you placed:Change event: Blood1 location: EnemyX,EnemyY. Switch: Blood1 ON.
What this does is moves the bloodevent directly under the enemy. It then activates the event switch so the blood can be seen. Give it a test try.
Oh dear, it seems there are one or two bugs?
after all, how the hell does the system know which blood event to use? Blood event1 will just dissapear from its own location and appear under a new location...and we don't want that. There is a simple way to fix it.
You have to tell the system that whenever a switch is activated, then it means that event is already in use and that it should go and try another blood event.
We use the following code:
IF Switch Blood1 is off
change event location: blood1: EnemyX, EnemyY
Switch Blood1 ON
Else
IF Switch Blood2 is off
change event location: blood2: EnemyX, EnemyY
Switch Blood2 ON
etc... and you would repeat the above steps with all f the blood events you have. (You can have as many as you want).
What this piece of code does is tells the system to check whether blood event1 is active, if it isn't, it will use it and turn blood switch 1 on. If it was already ative to begin with (The enemy has already been shot and blood event1 is already on the floor somewhere.) it will go through and check until it finds an event which hasn't been used. If it finds no events to use, it will not display any blood of course. NB: You will have to turn off all blood switches in the teleport event to leave the map. This is because the events are reset when you leave the map. There are ways around this, which I will talk about in Part 2.
Anyway, I hope you have been enlightened by this tutorial, and if you didn't understand any of my babble, here is the code, ignore the bracketed parts. (This code shows an example for five blood events).
(CODE FOR ABS)
(ENEMY HAS BEEN SHOT CODE)
<>COMMENT: BLOOD SYSTEM
<>Show battle animation: blood,Enemy1 (optional)
<> Branch IF Switch Blood1 is OFF
<> Change Event Location: Blood1 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood1] ON
<> Else Handler
<> Branch IF Switch Blood2 is OFF
<> Change Event Location: Blood2 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood2] ON
<> Else Handler
<> Branch IF Switch Blood3 is OFF
<> Change Event Location: Blood3 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood3] ON
<> Else Handler
<> Branch IF Switch Blood3 is OFF
<> Change Event Location: Blood3 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood3] ON
<> Else Handler
<> Branch IF Switch Blood4 is OFF
<> Change Event Location: Blood4 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood4] ON
<> Else Handler
<> Branch IF Switch Blood5 is OFF
<> Change Event Location: Blood5 (Var: EnemyX, Var: EnemyY)
<> Switch operation [Blood5] ON
<> Else Handler
-- Enjoy!! -- ;D