hallo freunde....
wie ihr seht hab ich am anfang einen code fürs
Hier das
Alles anzeigen
wie ihr seht hab ich am anfang einen code fürs
[color=#FF0000]throwen[/color]
und einen fürs pickup
.....und komischerweise funktioniert es nicht.....also wenn ich jetzt das pickup rausnehme ,funktioniert der throw einwandfrei, aber mit dem pickup ist es so(also wenn beide codes im step event sind) ,das beim throw nur die pfeile abgeschossen werden und keine animation abgespielt wird...und dazu auch beim pickup nicht.....das selbe auch wenn ich throw rausnehme..dann funktioniert pickup einwandfrei......bitte was ist daran falschHier das
ganze step event
von mirGML-Quellcode
- ///PLAYER MOVEMENT AND INTERACT
- if (xp >=5000)
- {
- xp=0;
- global.levelup+=1;
- }
- //!!--Throw--!!//
- if (throw == 0 && global.lastpressed == "right")
- {
- sprite_index = spr_player_idle_right;
- image_speed = 0.3;
- }
- else if (throw == 1 && global.lastpressed == "right")
- {
- sprite_index = spr_player_throw_right;
- image_speed = 0.6;
- }
- else if (throw == 0 && global.lastpressed=="left")
- {
- sprite_index = spr_player_idle_left;
- image_speed = 0.3;
- }
- else if (throw == 1 && global.lastpressed == "left")
- {
- sprite_index = spr_player_throw_left;
- image_speed = 0.6;
- }
- if mouse_check_button_pressed(mb_left) && !sound_isplaying(snd_throw)
- {
- sound_play(snd_throw);
- image_index = 0;
- throw = 1;
- alarm[0] = 20;
- instance_create(x,y+50,obj_pfeil);
- }
- //!!--Pick Up--!!//
- if (pickup==0)
- {
- if (global.lastpressed=="right")
- {
- image_speed=0.3;
- sprite_index=spr_player_idle_right;
- }
- else if (global.lastpressed=="left")
- {
- image_speed=0.3;
- sprite_index=spr_player_idle_left;
- }
- if keyboard_check_pressed(global.key_interact)
- {
- if global.lastpressed=="right"
- {
- sprite_index=spr_player_pickup_right;
- image_speed=0.6;
- image_index=0;
- alarm[1] = 40;
- pickup=1;
- }
- else if (global.lastpressed=="left")
- {
- sprite_index=spr_player_pickup_left;
- image_speed=0.6;
- image_index=0;
- alarm[1] = 40;
- pickup=1;
- }
- }
- }
- //!!--Horizontale Geschwindigkeit--!!//
- hspeed=0;
- //!!--Health Player--!!//
- if (hp <=0)
- {lives-=1
- hp=100;
- }
- if (lives <=0) && (global.lastpressed=="right")
- {
- sprite_index=spr_player_died_right;
- }
- else if (lives <=0) && (global.lastpressed=="left")
- {
- sprite_index=spr_player_died_left;
- }
- //!!--Wenn die Taste gedrückt wird--!!//
- if keyboard_check(global.key_left)
- {
- scr_movement("left");
- global.lastpressed="left";
- image_speed=0.3;
- sprite_index=spr_player_run_left;
- }
- if keyboard_check_released(global.key_left)
- {
- hspeed=0
- global.lastpressed="left";
- image_speed=0.2;
- sprite_index=spr_player_idle_left;
- }
- if keyboard_check(global.key_right)
- {
- scr_movement("right");
- global.lastpressed="right";
- image_speed=0.3;
- sprite_index=spr_player_run_right;
- }
- if keyboard_check_released(global.key_right)
- {
- hspeed=0
- global.lastpressed="right";
- image_speed=0.2;
- sprite_index=spr_player_idle_right;
- }
- //!!--Schild--!!//
- if (global.item1 > 0) && keyboard_check_pressed(global.key_schild)
- {
- if !instance_exists(obj_schild)
- {
- global.item1-=1;
- instance_create(x,y,obj_schild)
- image_speed=0.3;
- }
- }
- //!!--Gravitation--!!//
- vspeed+=0.8;
- //!!--Schneller Rennen--!!//
- if keyboard_check(global.key_shift)
- {
- movespeed*=2;
- }
- //!!--Springen--!!//
- if keyboard_check_pressed(global.key_up)
- {
- if place_free(x,y+10) == false
- {
- jump=1;
- vspeed=-12;
- }
- }
- //!!--Sprunghöhe ändern--!!//
- if keyboard_check_released(global.key_up)
- {
- if (vspeed < 0)
- vspeed /=2;
- }
- //!!--Kollisionserkennung links rechts--!!//
- if place_free(x+hspeed,y) == false
- {
- if (hspeed > 0){
- move_contact_solid(0,-1)} ///0 ist rechts 180 ist links
- if (hspeed < 0){
- move_contact_solid(180,-1)}
- hspeed=0;
- }
- //!!--Kollisionserkennung oben unten--!!//
- if place_free(x,y+vspeed) == false
- {
- if (vspeed > 0){
- move_contact_solid(270,-1)} ///270 ist unten 90 ist oben
- if (vspeed < 0){
- move_contact_solid(90,-1)}
- vspeed=0;
- }
- //!!--Nicht an Ecken hängen bleiben--!!//
- if place_free(x+hspeed,y+vspeed) == false
- {
- hspeed=0;
- }
- if place_free(x,y+10) //Abfrage wenn wir springen dann sollen die sprites verwendet werden und wenn wir am boden sind diese sprites....
- { //In der Luft
- if global.lastpressed == "right"
- sprite_index =spr_player_jump_right // Nach Rechts Schauen
- else
- sprite_index = spr_player_jump_left // Nach Links Schauen
- }
- //!!--View--!!//
- view_xview= ((x-view_wview/2)+view_xview*9)/10;
- view_yview= ((y-view_hview/2)+view_yview*9)/10;
- //!!--View nicht aus dem Raum--!!//
- if (view_xview <0)
- {
- view_xview=0;
- }