From eb57c2d7c9d560c2658f78fd536aaab24b925100 Mon Sep 17 00:00:00 2001 From: rick Date: Sun, 6 Dec 2020 15:50:42 +0100 Subject: [PATCH] Modification code attaque --- objects/oPlayer/KeyPress_74.gml | 54 +++++++++++---------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/objects/oPlayer/KeyPress_74.gml b/objects/oPlayer/KeyPress_74.gml index 887bca0..2134b92 100644 --- a/objects/oPlayer/KeyPress_74.gml +++ b/objects/oPlayer/KeyPress_74.gml @@ -3,45 +3,27 @@ //jouer l'animation isAttack = true; compteurFrames = 0; -tailleEpee = 30; // à définir -checkCote = image_index / 8; // récupère où regarde le personnage -inst = noone; +tailleEpee = 20; // à définir -if (sprite_index == sPlayerRun) { - if (checkCote <= 1) { - inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, false, oPlayer); +switch (indexImageInfo) { + case 0: + inst = collision_rectangle(x-5, y, x+5, y+tailleEpee, oMonster, false, oPlayer); //inst = getCollisionArea(x-5, y+tailleEpee, x+5, y+tailleEpee, oMonster); - } else if (checkCote <= 2) { - 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) - } else if (checkCote <= 3) { - 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) - } else if (checkCote <= 4) { - inst = collision_rectangle(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster, false, oPlayer); + break; + case 1: + inst = collision_rectangle(x, 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, 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, y+5, oMonster, false, oPlayer); //inst = getCollisionArea(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster); - } -} 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; - } + break; + default: + inst = noone; } if (inst != noone) {