4
0
Fork 0

ajout fonction check rectangle et détection d'un ennemi lors de l'attaque

This commit is contained in:
rick 2020-12-05 17:19:25 +01:00
commit 148ea2197b
3 changed files with 39 additions and 6 deletions
scripts/Script1

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;
}