Skocz do zawartości

Rekomendowane odpowiedzi

Opublikowano

Siemka.Napisalem Kod na powstawanie obj wokol gracza.Mialy to byc czary podobne jak w tibi(na okolo gracza).Dzialaly ale jak dodalem ze ma odejmowac 5 energi to juz nie dziala :/ Kod:

GML
if global.LVL >= 0 & global.Energy >= 5

{

global.Energy -=5

 

//Nad Graczem

instance_create(obj_Player.x-10,obj_Player.y-30,mwg_1)//wys:1,nad graczem

instance_create(obj_Player.x-40,obj_Player.y-30,mwg_1)//wys:1,lewo:1

instance_create(obj_Player.x+20,obj_Player.y-30,mwg_1)//wys:1,prawo:1

instance_create(obj_Player.x-10,obj_Player.y-60,mwg_1)//wys:2,nad graczem

instance_create(obj_Player.x-40,obj_Player.y-60,mwg_1)//wys:2,lewo:1

instance_create(obj_Player.x+20,obj_Player.y-60,mwg_1)//wys:2,prawo:1

instance_create(obj_Player.x-10,obj_Player.y-90,mwg_1)//wys:3,nad graczem

instance_create(obj_Player.x-40,obj_Player.y-90,mwg_1)//wys:3,lewo:1

instance_create(obj_Player.x+20,obj_Player.y-90,mwg_1)//wys:3,prawo:1

instance_create(obj_Player.x-10,obj_Player.y-120,mwg_1)//wys:4,nad graczem

instance_create(obj_Player.x-40,obj_Player.y-120,mwg_1)//wys:4,lewo:1

instance_create(obj_Player.x+20,obj_Player.y-120,mwg_1)//wys:4,prawo:1

//Pod Graczem

instance_create(obj_Player.x-10,obj_Player.y+30,mwg_1)//wys:-1,pod graczem

instance_create(obj_Player.x-40,obj_Player.y+30,mwg_1)//wys:-1,lewo:1

instance_create(obj_Player.x+20,obj_Player.y+30,mwg_1)//wys:-1,prawo:1

instance_create(obj_Player.x-10,obj_Player.y+60,mwg_1)//wys:-2,pod graczem

instance_create(obj_Player.x-40,obj_Player.y+60,mwg_1)//wys:-2,lewo:1

instance_create(obj_Player.x+20,obj_Player.y+60,mwg_1)//wys:-2,prawo:1

instance_create(obj_Player.x-10,obj_Player.y+90,mwg_1)//wys:-3,pod graczem

instance_create(obj_Player.x-40,obj_Player.y+90,mwg_1)//wys:-3,lewo:1

instance_create(obj_Player.x+20,obj_Player.y+90,mwg_1)//wys:-3,prawo:1

instance_create(obj_Player.x-10,obj_Player.y+120,mwg_1)//wys:-4,pod graczem

instance_create(obj_Player.x-40,obj_Player.y+120,mwg_1)//wys:-4,lewo:1

instance_create(obj_Player.x+20,obj_Player.y+120,mwg_1)//wys:-4,prawo:1

//Lewo:

instance_create(obj_Player.x-40,obj_Player.y-30,mwg_1)//wys:1,lewo:1

instance_create(obj_Player.x-40,obj_Player.y-0,mwg_1)//wys:0,lewo:1

instance_create(obj_Player.x-40,obj_Player.y+30,mwg_1)//wys:-1,lewo:1

instance_create(obj_Player.x-70,obj_Player.y-30,mwg_1)//wys:1,lewo:2

instance_create(obj_Player.x-70,obj_Player.y-0,mwg_1)//wys:0,lewo:2

instance_create(obj_Player.x-70,obj_Player.y+30,mwg_1)//wys:-1,lewo:2

instance_create(obj_Player.x-100,obj_Player.y-30,mwg_1)//wys:1,lewo:3

instance_create(obj_Player.x-100,obj_Player.y-0,mwg_1)//wys:0,lewo:3

instance_create(obj_Player.x-100,obj_Player.y+30,mwg_1)//wys:-1,lewo:3

instance_create(obj_Player.x-130,obj_Player.y-30,mwg_1)//wys:1,lewo:4

instance_create(obj_Player.x-130,obj_Player.y-0,mwg_1)//wys:0,lewo:4

instance_create(obj_Player.x-130,obj_Player.y+30,mwg_1)//wys:-1,lewo:4

//Prawo:

instance_create(obj_Player.x+20,obj_Player.y-30,mwg_1)//wys:1,prawo:1

instance_create(obj_Player.x+20,obj_Player.y-0,mwg_1)//wys:0,prawo:1

instance_create(obj_Player.x+20,obj_Player.y+30,mwg_1)//wys:-1,prawo:1

instance_create(obj_Player.x+50,obj_Player.y-30,mwg_1)//wys:1,prawo:2

instance_create(obj_Player.x+50,obj_Player.y-0,mwg_1)//wys:0,prawo:2

instance_create(obj_Player.x+50,obj_Player.y+30,mwg_1)//wys:-1,prawo:2

instance_create(obj_Player.x+80,obj_Player.y-30,mwg_1)//wys:1,prawo:3

instance_create(obj_Player.x+80,obj_Player.y-0,mwg_1)//wys:0,prawo:3

instance_create(obj_Player.x+80,obj_Player.y+30,mwg_1)//wys:-1,prawo:3

instance_create(obj_Player.x+110,obj_Player.y-30,mwg_1)//wys:1,prawo:4

instance_create(obj_Player.x+110,obj_Player.y-0,mwg_1)//wys:0,prawo:4

instance_create(obj_Player.x+110,obj_Player.y+30,mwg_1)//wys:-1,prawo:4

}

Powiecie co tu jest zle? Z gory dziex :]

Opublikowano

energia bedzie się odejmowac cały czas bo kod zapewne jest w stepie a nie dzialac ci moze dlatego ze gdzies w jakims objekcie masz global.Energy=(iles tam) nie w create ;p

 

A tak w ogóle tworzenie tylu obiektów na raz jest nie zdrowe a nawet jeśli łatwiej by ci było uzyć pętli for i lenghtdirów ;p

 

Edit: o nie zauwarzyłem musisz poprawić & na and albo &&

Opublikowano
jak zrobic zeby jakis objekt znikal np po 1sec

Ile będziecie ciągle pytać o o samo? <_<

GML
//create:

alarm[0]=room_speed

//alarm 0:

instance_destroy()

 

E: Za wolny;/

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...