hola este codigo es para crear un golpe cuando estas el el suelo y el otro cuando esta en el aire funciona bien, el unico problema es que cuando presiono el boton "up" y el boton A o S o Z o X al mismo tiempo el personaje se traba por un momento mostrando el sprite del personaje golpeando en el suelo cuando esta en el aire. alguna ayuda
ground = 672
if obj_player1.y = 672
{
scr_drawattack(ord('A'), stand, jab, jab_box, 5, 'normal')
scr_drawattack(ord('S'), stand, cross, cross_box, 5, 'normal')
scr_drawattack(ord('Z'), stand, low, low_box, 5, 'normal')
scr_drawattack(ord('X'), stand, high, high_box, 5, 'normal')}
if obj_player1.y > 0
{
scr_drawattack(ord('A'), stand, air, air_box, 5, 'normal')
scr_drawattack(ord('S'), stand, air, air_box, 5, 'normal')
scr_drawattack(ord('Z'), stand, air, air_box, 5, 'normal')
scr_drawattack(ord('X'), stand, air, air_box, 5, 'normal')
}
Podes poner el codigo completo cuando presionas las teclas ???
el script de arriba llama este otro script
var key, spr_base, spr_atk, spr_atk_hitbox, damage, type;
key = argument0
spr_base = argument1
spr_atk = argument2
spr_atk_hitbox = argument3
damage = argument4
type = argument5
//this code looks to see if attack animation has completed
//if so, return back to base sprite
if sprite_index == spr_atk//if currently attacking
{if image_index == image_number - 1//check if animation finished
{sprite_index = spr_base;
action = false}
}//if animation finished return to base
if scr_preventattack(){exit}
if keyboard_check_pressed(key)
{var atkbox;
atkbox = instance_create(x,y, obj_attackbox)
atkbox.owner = self.id
atkbox.sprite_index = spr_atk_hitbox
atkbox.image_index = 0
atkbox.damage = damage
atkbox.type = type
}
//if currently not attacking, and a key has been pressed
//change sprite to attack sprite
if keyboard_check_pressed(key)
{if sprite_index != spr_atk
{image_index = 0;
sprite_index = spr_atk;
action = true}
}
En la última parte del código, no nada más hay que revisar si se presiona la tecla de ataque para mostrar la animación de ataque, habría que revisar si se está en el suelo o en el aire para decidir qué sprite se muestra.