I
Ibrahim Ahmed Sharif
Guest
Ok so the thing is I'm trying to make a game where you swing the sword around with the mouse, like this:
but I don't want the enemy to get hurt all the time, so I've made a global variable called collisionMask that determines if the enemy can be hurt. I'm trying to do so that every second it turns the collisionMask to 1 (true) but it doesn't work for some reason. Please help.
Weapon create code:
Weapon step code:
Alarm 0 event:
Enemy step code:
Weapon create code:
alarm[0] = 1*room_speed
Weapon step code:
if place_meeting(x, y, obj_enemyParent) && global.collisionMask == 1
{
global.collisionMask = 0;
alarm[0] = 2*room_speed;
}
{
global.collisionMask = 0;
alarm[0] = 2*room_speed;
}
Alarm 0 event:
global.collisionMask = 1;
Enemy step code:
if place_meeting(x, y, obj_playerWeapon) && global.collisionMask == 1
{
hitSound = choose(orcHitSound1, orcHitSound2)
audio_play_sound(hitSound, 10, 0);
instance_create_layer(x, y, "Instances_1", obj_blood);
}
{
hitSound = choose(orcHitSound1, orcHitSound2)
audio_play_sound(hitSound, 10, 0);
instance_create_layer(x, y, "Instances_1", obj_blood);
}