Enero 27, 2014, 03:51:19 AM Ultima modificación: Enero 27, 2014, 04:09:36 AM por yokaiworld
hola
trabajando con mi juego de peleas he logrado que el player2 apenas empiece el round, se lance contra el player1. He creado el objeto circulo que sigue al player1, cuando el player2 choca con el objeto circulo comience a lanzar golpes y no se detiene: cuando camina el sprite que muestra es el de golpe no el de walking,  pareciera que  realiza esta funcion infinitamente y de un solo golpe mata al player1. (cuando el script dice que solo sea el 5%)

Como hago para que pare y siga normal?



Para player2 quedo asi:
scr_drawattack


var  spr_base, spr_atk, spr_atk_hitbox, damage, type;
spr_base = argument0
spr_atk = argument1
spr_atk_hitbox = argument2
damage = argument3
type = argument4

//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 instance_exists(obj_player2)
    {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 instance_exists(obj_player2)
    {if sprite_index != spr_atk
        {image_index = 0;
        sprite_index = spr_atk;
        action = true}
    }

   
en step execute script
scr_attack2


if object_index == obj_player2

{
scr_drawattack2(true, stand, jab,   jab_box,   5, 'normal')}

alguna sugerencia


Obj_player2 choca contra obj_circulo y comienza a lanzar golpes como loco!!!!




he adaptado  de los siguiente scripts del player 1:
scr_drawattack

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 step execute script
scr_attack


if object_index == obj_player1{

scr_drawattack(ord('A'), stand, jab,   jab_box,   5, 'normal')
scr_drawattack(ord('S'), stand, cross, cross_box, 7, 'normal')
scr_drawattack(ord('Z'), stand, low,   low_box,   5, 'normal')
scr_drawattack(ord('X'), stand, high,  high_box,  6, 'juggle')}

gracias