Hi, meine Kanone schießt immer in einer Richtung. Ich möchte aber, dass die Kanone in die Richtung des Cursors schießt. DER CODE:
Alles anzeigen
Weis jetz einer, was ich bei " // determine what you hit" ändern muss. Ich habs schon versucht, aber irgendwie gehts nicht.
GML-Quellcode
- {
- // check whether you can shoot
- if (not can_shoot) exit;
- can_shoot = false;
- // show the animation and play the sound
- image_speed = 0.4;
- image_index = 0;
- sound_play(snd_shot2);
- // determine what you hit
- var xx, yy, ii;
- xx = global.camx;
- yy = global.camy;
- repeat (50)
- {
- xx += 4*global.camcos;
- yy -= 4*global.camsin;
- ii = instance_position(xx,yy,obj_wall_basic);
- if (ii == noone)
- {
- ii = instance_position(xx,yy,obj_monster_basic);
- if (ii == noone) continue;
- with (ii) instance_destroy();
- break;
- }
- if object_is_ancestor(ii.object_index,obj_plant_basic) continue;
- if (ii.object_index == obj_barrel) || (ii.object_index == obj_door)
- with (ii) instance_destroy();
- break;
- }
- }
Weis jetz einer, was ich bei " // determine what you hit" ändern muss. Ich habs schon versucht, aber irgendwie gehts nicht.