Gasil
Member
Hello everybody. I seek your advice.
I'm setting up a meele attack on a top down shooter, an attack I want to be able to hit every enemy that collides with its collision mask.
However, as you guessed, an enemy of 10 hp dies instantly on a meele attack of 1 damage because the collision activates per step (I'm using collision event between object_attack and object_enemy)
So I set up an Invincible = 0; variable, and an alarm to make the enemy flash and invulnerable for a few frames just to stop the collision while the attack animation ends.
It worked well according to what I wanted, until I tried to hit multiple instances of the same obj_enemy; I'm assuming everyone of them becomes invincible after the first hit and I am just able to hit and damage a single enemy even if they are all clustered up. Is there a way to make the game set up an alarm for every instance? Or should I use another approach for this purpouse?
This is the code I have:
This is the alarm that's under the obj_enemy alarm 0 event
Could you help me please sharing any other approch to this purpouse if necessary?
Thank you.
I'm setting up a meele attack on a top down shooter, an attack I want to be able to hit every enemy that collides with its collision mask.
However, as you guessed, an enemy of 10 hp dies instantly on a meele attack of 1 damage because the collision activates per step (I'm using collision event between object_attack and object_enemy)
So I set up an Invincible = 0; variable, and an alarm to make the enemy flash and invulnerable for a few frames just to stop the collision while the attack animation ends.
It worked well according to what I wanted, until I tried to hit multiple instances of the same obj_enemy; I'm assuming everyone of them becomes invincible after the first hit and I am just able to hit and damage a single enemy even if they are all clustered up. Is there a way to make the game set up an alarm for every instance? Or should I use another approach for this purpouse?
This is the code I have:
Code:
/// @meele attack collision (this is written on the obj_meeleattack, the attack animation, on a collision event with the obj_enemy)
if (cooldownDamage = 0)
{
with (other)
{
hp = hp - damage;
cooldownDamage = 1;
obj_enemy.alarm[0] = 60;
}
}
Code:
cooldownDamage = 0;
Thank you.