W
Wild_West
Guest
So I decided against actually making my character's attacks a series of just 1 then 2 then 3 in favor of just having a few different slashing animations that all are done with the 'A' key, in addition to a stabing attack, and a hammer drop kinda animation.
The spear and hammer are fine, trouble is with the 3 slashes.
I tried to make it as compact as I could all commands in one script, no args and just call it in the player step event.
But I guess since I'm using so many 'A' key commands in one script it can't execute since when I shortened it to one attack for 'A' of curse that worked fine.
So anybody have an idea how I can make it so pressing 'A' results in choosing from 1 of the 3 slash animations I have?
This is the working code as of now.
///perform_attack_basic();
if(keyboard_check_pressed(ord("A") ) ) and not(keyboard_check(vk_up) )
{ slash_value = choose(1,2,3); }
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 1)
{
sprite_index = slash1
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash1) and (image_index = round(1) )
{
instance_create(x,y,Rslash1_dmg);
}
//-------------------------------------------------------------
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 2)
{
sprite_index = slash2
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash2) and (image_index = round(3) )
{
instance_create(x,y,Rslash2_dmg);
}
//----------------------------------------------------------------
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 3)
{
sprite_index = slash3;
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash3) and (image_index = round(3) )
{
instance_create(x,y,Rslash3_dmg);
}
//------------------------------------------------------------------
//Overhead attack Variation
if(keyboard_check(vk_up) + keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check(vk_up) + keyboard_check_pressed(ord("A") ) ) and not(move_right)
{
image_index = overhead;
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = overhead) and (image_index = round(2) )
{
instance_create(x,y,Roverhead_dmg);
}
The spear and hammer are fine, trouble is with the 3 slashes.
I tried to make it as compact as I could all commands in one script, no args and just call it in the player step event.
But I guess since I'm using so many 'A' key commands in one script it can't execute since when I shortened it to one attack for 'A' of curse that worked fine.
So anybody have an idea how I can make it so pressing 'A' results in choosing from 1 of the 3 slash animations I have?
This is the working code as of now.
///perform_attack_basic();
if(keyboard_check_pressed(ord("A") ) ) and not(keyboard_check(vk_up) )
{ slash_value = choose(1,2,3); }
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 1)
{
sprite_index = slash1
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash1) and (image_index = round(1) )
{
instance_create(x,y,Rslash1_dmg);
}
//-------------------------------------------------------------
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 2)
{
sprite_index = slash2
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash2) and (image_index = round(3) )
{
instance_create(x,y,Rslash2_dmg);
}
//----------------------------------------------------------------
if(keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check_pressed(ord("A") ) ) and not(move_right)
and(slash_value = 3)
{
sprite_index = slash3;
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = slash3) and (image_index = round(3) )
{
instance_create(x,y,Rslash3_dmg);
}
//------------------------------------------------------------------
//Overhead attack Variation
if(keyboard_check(vk_up) + keyboard_check_pressed(ord("A") ) ) and not(move_left)
or(keyboard_check(vk_up) + keyboard_check_pressed(ord("A") ) ) and not(move_right)
{
image_index = overhead;
image_speed = 0.2;
}
//create the damaging object
if(sprite_index = overhead) and (image_index = round(2) )
{
instance_create(x,y,Roverhead_dmg);
}