Information about object: obj_red_spider2 Sprite: spr_spider_red Solid: false Visible: true Depth: 0 Persistent: false Parent: obj_hindrance Mask: Create Event: set variable can_move to 1 execute code: { msx=16; msy=0; indanger=0; } Destroy Event: create instance of object obj_bonus at relative position (0,0) execute script explosion with arguments (0,0,0,0,0) //siehe unten Alarm Event for alarm 0: set variable can_move to 1 //spinne kann sich weiter bewegen Step Event: execute code: { //sprite für die richtige richtung aussuchen if (msx==16) { sprite_index=spr_spider_red; } else if (msx==-16) { sprite_index=spr_red_left; } else if (msy==16) { sprite_index=spr_red_down; } else if (msy==-16) { sprite_index=spr_red_up; } } if can_move is equal to 1 execute code: { ii=instance_position(x+msx,y+msy,obj_hindrance); //schauen, ob an der nächsten position eine Kollision ist if (ii==noone) meldung=0; //rückmeldung geben else meldung=1; } if meldung is equal to 0 set variable can_move to 0 //bewegen execute code: { x=x+msx; y=y+msy; } set Alarm 0 to 5 //alarm setzen, bis zur nächsten bewegung set variable indanger to 0 //kollisionszähler zurücksetzen else set variable indanger relative to 1 //bei kollision: kollisionszähler erhöhen & Richtung ändern execute code: { if (msx==16) { if (msy==0) { msx=0; msy=16; } } else if (msx==0) { if (msy==16) { msx=-16; msy=0; } else if (msy==-16) { msx=16; msy=0; } } else if (msx==-16) { if (msy==0) { msx=0; msy=-16; } } } if indanger is equal to 4 //wenn alle richtungen belegt sind destroy the instance //instanz vernichten execute script arcysearch with arguments (0,0,0,0,0) //nach dem helden suchen //Script explosion: { //sternförmig um das objekt herum explodieren ii=instance_position(x+16,y,all); if(ii==noone) {} else { with (ii) instance_destroy(); } ii=instance_position(x-16,y,all); if(ii==noone) {} else { with (ii) instance_destroy(); } ii=instance_position(x,y+16,all); if(ii==noone) {} else { with (ii) instance_destroy(); } ii=instance_position(x,y-16,all); if(ii==noone) {} else { with (ii) instance_destroy(); } }