This can also be classified as collision physics. When two physics objects collide, both would have a collision response. Also, a different response will be produced if a physics object collided with a non-physics object. Likewise, different collision response occur no matter which object collides and requires variable adjustment. Shown below is a block of collision response codes that simulate such response.
Referenced from a Lite-C example: Enemy moves back when hit by player with sword
ACTION enemy_dummy {
my.shadow = on;
my.entity_type = 2;
my.enable_scan = on;
WHILE (1) {
IF (my.hit_by_player == 1) {
my.move_x = player.move_x;
my.move_y = player.move_y;
my.move_z = player.move_z;
c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide);
IF (player.animblend == blend || player.animblend < attack_a || my.animblend > attack_f) { my.hit_by_player = 0; }
}
IF (player.animblend >= stand && target_enemy == my && player_lock_on == 0) && (player.animblend < attack_a || player.animblend > attack_f) { target_enemy = null; }
IF (target_enemy == my && vec_dist(my.x,player.x) > 200) { target_enemy = null; }
wait(1);
}
}
Damage dealt is calculated differently when a target is hit differently on different parts of its model/mesh.
The damage count will be higher on vital area such as, the head region. This is where 2 hits are enough to dispatch a target regardless of its remaining life points, except for the case of the final boss character.
Hits on non-vital areas will require about 4-5 hits to successfully take down a target with full life points. However, the exact damage roll will be dependant on the “Damage rating” of the weapon being used divided by the target’s armor bonus.
Formula 3:
Life Span = Current Life Span – (Weapon damage / armor)
Shown below is a simple flow of how the combat physics will be implemented.
Recent Comments