Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> A Simple Attack System, A how-to on making a simple attack system
ewcreators
post Mar 26 2008, 02:58 PM
Post #1


Member [Level 1]
****

Group: Members
Posts: 59
Joined: 28-August 07
Member No.: 48,983




-----------------------
Game Making ::Simple Attack Script::
Ok, When making my first, ok well second ..ok , my current and third one (first 2 were really bad, but then i found out my own way on how to make an idea script), I would always first write down or think of the stats of the character. For the purpose of this tut, i will be using space-ship kinda stats(since my first proper attack script was a space battle script) :

The Attack Stats :
  • -Accuracy(Aim)
  • -Hull Damage(Main Dmg.)

Defense Stats :
  • -Shield Power(Armor)
  • -Speed(dodge/swiftness)


ATTACK/DAMAGE STATS
Now , the main thing is that you visualize a real fight or fights on other games.
Usually, the attacker gets the first blow, giving him an edge/incentive in attacking.
The stat used for this is Hull Damage and its factor is Accuracy.


Well, usually in my attack scripts, i don't find a way to make "Accuracy" do its purpose, so instead, i just add it to the Main Damage equation. I'm not gonna reveal some actual attack equations, ill just give a base simple one like most games have.

CODE
//create the equation for the attacker
$hit_1 =round(rand(1,$damage_1) * $accuracy_1 + $level_1 ) / $ level_1   / $accuracy_1 + 1);

//create the equation for the defender
$hit_2 =round(rand(1,$damage_2) * $accuracy_2 + $level_2 ) / $ level_2 / $accuracy_2);


$hit_1 is the attack equation for the person who attacks aka the Attacker.
$hit_2 is the attack equation for the person who is being attacked aka the Defender.
You may notice, that in the second equation, there is no +1 at the end. this is because, the defender doesn't gain an incentive like the attacker. The attacker is the one who starts the fight thus taking the first blow which gives + 1 damage. Then the defender retaliates giving +0 bonus when he attacks back.


This is not so much, its barely little, but I have some other work right now, so I will continue this tomorrow, or possibly a little more later on today if i can. The next part will be on how to utilize the defense stats and how to make the dodge stat "dodge" and the shield stat "defend".
After that, we will lay out the entire structure and go through how it all fits in into 1 thing.

~Ewcreators aka Aldo
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Making Games(16)


 



- Lo-Fi Version Time is now: 24th July 2008 - 12:33 PM