4
0
Fork 0
This commit is contained in:
sOlaris38 2020-12-05 17:28:47 +01:00
commit 47feaf0ccf
3 changed files with 39 additions and 6 deletions

View file

@ -7,15 +7,19 @@
switch (image_index) {
case 0:
inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, true, 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, true, 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, true, 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, true, oPlayer);
//inst = getCollisionArea(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster);
break;
default:
inst = noone;
@ -28,3 +32,15 @@
//a supp
show_debug_message("pas d'objet...");
}
/*
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...");
}
*/

View file

@ -24,6 +24,7 @@
{"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",},
{"isDnD":false,"eventNum":0,"eventType":4,"collisionObjectId":{"name":"oMonster","path":"objects/oMonster/oMonster.yy",},"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",},

View file

@ -1,7 +1,23 @@
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function Test(){
// C'est un test de git
//retest git
/*
@description Récupère tous les instances d'obj se trouvant dans un rectangle
@param {x1} coordonnée x gauche du rectangle
@param {y1} coordonnée y haut du rectangle
@param {x2} coordonnée x droit du rectangle
@param {y2} coordonnée y bas du rectangle
@param {obj} le type des instances à chercher
@return la liste des id des instances se trouvant dans le restangle
*/
function getCollisionArea(x1, y1, x2, y2, obj){
list = ds_list_create();
with(obj) {
if ( x >= x1 && x <= x2 && y >= y1 && y <= y2) {
ds_list_add(list, obj.id);
}
}
return list;
}