Codice: Seleziona tutto
rightkey = keyboard_check(ord("D"))
leftkey = keyboard_check(ord("A"))
upkey = keyboard_check(ord("W"))
downkey = keyboard_check(ord("S"))
attackkey = mouse_check_button(mb_left)
if rightkey && place_free(x+4,y) && sprite_index != spr_Player_Attack {
x += 3
sprite_index = spr_Player_Run;
image_speed = .2;
image_xscale = 1;
}
if leftkey && place_free(x-4,y) && sprite_index != spr_Player_Attack {
x -= 3
sprite_index = spr_Player_Run;
image_speed = .2;
image_xscale = -1;
}
if upkey && place_free(x,y-4) && sprite_index != spr_Player_Attack {
y -= 3
sprite_index = spr_Player_Run;
image_speed = .2;
}
if downkey && place_free(x,y+4) && sprite_index != spr_Player_Attack {
y += 3
sprite_index = spr_Player_Run;
image_speed = .2;
}
if attackkey && sprite_index != spr_Player_Attack {
sprite_index = spr_Player_Attack;
image_speed = .5;
}
if !rightkey && !leftkey && !upkey && !downkey {
image_speed = .2;
sprite_index = spr_Player_Stand;
}
Codice: Seleziona tutto
if sprite_index == spr_Player_Attack {
sprite_index = spr_Player_Stand;
}