Jump to content


Photo

Help with combo animation


  • Please log in to reply
2 replies to this topic

#1 daro0196

daro0196

    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM8

Posted 28 May 2012 - 06:51 PM

Do you know how to make combos, i tried with this code but the sprite doesnt change

{
if(keyboard_check_pressed(vk_space)) and facing=1
{
alarm[1] = 90;
combo1 += 1;
if combo1 = 1{
sprite_index = spr_thanatos_atk_1_sword_right
image_index=0;
}
if combo1 = 2{
sprite_index = spr_thanatos_atk_1_sword_right_2
image_index=0;
}
if combo1 > 3{
combo1 = 0;
}
}
if(sprite_index == spr_thanatos_atk_1_sword_right && image_index == 6)
{
sprite_index = spr_thanatos_stand_right;
  • 0

#2 Noele

Noele

    GMC Mentor

  • GMC Member
  • 2353 posts
  • Version:GM8.1

Posted 28 May 2012 - 09:27 PM

You are setting alarm1 to 90 each time space is pressed and facing = 1.
Alarms events trigger when they reach zero and they are then set to -1. Testing if the alarm has already been set may solve your problem.
if(keyboard_check_pressed(vk_space) && facing == 1){
  if(alarm[1] == -1){
    alarm[1] = 90;
    combo1 += 1;
  }
  if (combo1 == 1){
    sprite_index = spr_thanatos_atk_1_sword_right
    image_index=0;
  }
  if (combo1 == 2){
    sprite_index = spr_thanatos_atk_1_sword_right_2
    image_index=0;
  }
  if (combo1 > 3){
    combo1 = 0;
  }
}
if(sprite_index == spr_thanatos_atk_1_sword_right && image_index == 6){
  sprite_index = spr_thanatos_stand_right;
}
No way of testing this as you didn't say what is in Alarm1 event but shouldn't if (combo1 > 3) be if (combo1 > 2) ???
  • 0

#3 daro0196

daro0196

    GMC Member

  • GMC Member
  • 41 posts
  • Version:GM8

Posted 29 May 2012 - 12:57 AM

You are setting alarm1 to 90 each time space is pressed and facing = 1.
Alarms events trigger when they reach zero and they are then set to -1. Testing if the alarm has already been set may solve your problem.

if(keyboard_check_pressed(vk_space) && facing == 1){
  if(alarm[1] == -1){
    alarm[1] = 90;
    combo1 += 1;
  }
  if (combo1 == 1){
    sprite_index = spr_thanatos_atk_1_sword_right
    image_index=0;
  }
  if (combo1 == 2){
    sprite_index = spr_thanatos_atk_1_sword_right_2
    image_index=0;
  }
Thanks for the help but it didnt worked, in alarm one the evente changes combo1 to 0 and if i press space it keeps doing the first animation....

  if (combo1 > 3){
    combo1 = 0;
  }
}
if(sprite_index == spr_thanatos_atk_1_sword_right && image_index == 6){
  sprite_index = spr_thanatos_stand_right;
}
No way of testing this as you didn't say what is in Alarm1 event but shouldn't if (combo1 > 3) be if (combo1 > 2) ???


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users