2020-12-05 16:09:52 +01:00
|
|
|
// Attaque au corp à corp
|
|
|
|
|
|
|
|
//jouer l'animation
|
2020-12-06 14:31:54 +01:00
|
|
|
isAttack = true;
|
|
|
|
compteurFrames = 0;
|
|
|
|
tailleEpee = 30; // à définir
|
|
|
|
checkCote = image_index / 8; // récupère où regarde le personnage
|
|
|
|
inst = noone;
|
2020-12-05 16:09:52 +01:00
|
|
|
|
2020-12-06 12:38:35 +01:00
|
|
|
if (sprite_index == sPlayerRun) {
|
|
|
|
if (checkCote <= 1) {
|
|
|
|
inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, false, oPlayer);
|
2020-12-05 17:19:25 +01:00
|
|
|
//inst = getCollisionArea(x-5, y+tailleEpee, x+5, y+tailleEpee, oMonster);
|
2020-12-06 12:38:35 +01:00
|
|
|
} else if (checkCote <= 2) {
|
|
|
|
inst = collision_rectangle(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster, false, oPlayer);
|
2020-12-05 17:19:25 +01:00
|
|
|
//inst = getCollisionArea(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster)
|
2020-12-06 12:38:35 +01:00
|
|
|
} else if (checkCote <= 3) {
|
|
|
|
inst = collision_rectangle(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster, false, oPlayer);
|
2020-12-05 17:19:25 +01:00
|
|
|
//inst = getCollisionArea(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster)
|
2020-12-06 12:38:35 +01:00
|
|
|
} else if (checkCote <= 4) {
|
|
|
|
inst = collision_rectangle(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster, false, oPlayer);
|
2020-12-05 17:19:25 +01:00
|
|
|
//inst = getCollisionArea(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster);
|
2020-12-06 12:38:35 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (image_index) {
|
|
|
|
case 0:
|
|
|
|
inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, false, oPlayer);
|
|
|
|
//inst = getCollisionArea(x-5, y+tailleEpee, x+5, y+tailleEpee, oMonster);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
inst = collision_rectangle(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster, false, oPlayer);
|
|
|
|
//inst = getCollisionArea(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster)
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
inst = collision_rectangle(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster, false, oPlayer);
|
|
|
|
//inst = getCollisionArea(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster)
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
inst = collision_rectangle(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster, false, oPlayer);
|
|
|
|
//inst = getCollisionArea(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
inst = noone;
|
|
|
|
}
|
|
|
|
}
|
2020-12-05 16:09:52 +01:00
|
|
|
|
|
|
|
if (inst != noone) {
|
2020-12-05 17:19:25 +01:00
|
|
|
show_debug_message("objet trouvé !");
|
|
|
|
// attaque
|
2020-12-06 12:38:35 +01:00
|
|
|
hit(self, inst, attack);
|
|
|
|
inst.touche = 30;
|
2020-12-05 16:09:52 +01:00
|
|
|
} else {
|
|
|
|
//a supp
|
|
|
|
show_debug_message("pas d'objet...");
|
2020-12-05 17:19:25 +01:00
|
|
|
}
|
|
|
|
|
2020-12-05 18:56:12 +01:00
|
|
|
|
2020-12-05 17:19:25 +01:00
|
|
|
/*
|
|
|
|
if (inst != noone && !ds_list_empty(inst)) {
|
|
|
|
show_debug_message("objet trouvé !");
|
|
|
|
show_debug_message(inst);
|
|
|
|
with (inst) instance_destroy();
|
|
|
|
// attaque
|
|
|
|
} else {
|
|
|
|
//a supp
|
|
|
|
show_debug_message("pas d'objet...");
|
|
|
|
}
|
|
|
|
*/
|