4
0
Fork 0

Ajout détection sprite attaque corps à corps

This commit is contained in:
rick 2020-12-05 16:09:52 +01:00
parent bd7a1411f9
commit 2ea0418857
3 changed files with 96 additions and 66 deletions

View file

@ -0,0 +1,30 @@
// Attaque au corp à corp
//jouer l'animation
tailleEpee = 20; // à définir
switch (image_index) {
case 0:
inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, true, oPlayer);
break;
case 1:
inst = collision_rectangle(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster, true, oPlayer);
break;
case 2:
inst = collision_rectangle(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster, true, oPlayer);
break;
case 3:
inst = collision_rectangle(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster, true, oPlayer);
break;
default:
inst = noone;
}
if (inst != noone) {
show_debug_message("objet trouvé !");
// attaque
} else {
//a supp
show_debug_message("pas d'objet...");
}

View file

@ -2,7 +2,6 @@ keyLeft = keyboard_check(vk_left) or keyboard_check(ord("Q"));
keyRight = keyboard_check(vk_right) or keyboard_check(ord("D"));
keyUp = keyboard_check(vk_up) or keyboard_check(ord("Z"));
keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
keyAttack = keyboard_check_pressed(vk_shift);
// Déplacement du joueur

View file

@ -23,6 +23,7 @@
"eventList": [
{"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":74,"eventType":9,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
],
"properties": [
{"varType":1,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"deplaceHorizontal","tags":[],"resourceType":"GMObjectProperty",},