1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

Combo Attack Issues

Discussion in 'Programming' started by BubbleMage123, Jul 27, 2018.

Tags:
  1. Hello,
    I am making a platformer-melee game controlled by mouse only. My goal is to create the combo attacks before I leave my pre-alpha stage of the game, but I'm having some troubles. I have been debugging this for about a week, and tutorials and other posts did not help much. Basically, what's happening now is my character will only punch. If I click really fast, it sometimes shows the first frame of the kick before switching back to stage 0. My code relating to this issue is below:
    Paige Moves:
    Code:
    ///Paige_Moves();
    brawl_check = false;
    if(mouse_button == mb_right && distance_to_point(mouse_x,mouse_y) == 0){
        State = e_state.blocking;
    }else if(State = e_state.blocking && mouse_check_button_released(mb_right)){
        State = e_state.normal;
    }else if (
    (mouse_button == mb_right) &&
    (distance_to_point(mouse_x,mouse_y) != 0) &&
    (State != e_state.blocking) &&
    (State != e_state.brawling)){
        State = e_state.brawling;
        brawl_check = true;
    }
    
    if(State = e_state.brawling && brawl_check){
        //stage = 0;
        Paige_Brawl();
        //brawl_check = false;
    }
    
    Paige Brawl:
    Code:
    ///Paige_Brawl();
    var combo_ready = mouse_check_button_pressed(mb_right) && (distance_to_point(mouse_x,mouse_y) != 0);
    var clicks = 1;
    stage = clicks - 1;
    //if(clicks > 3) clicks = 0; State = e_state.normal;
    if(can_switch_stage){
        if(combo_ready){
            clicks += 1;
            can_switch_stage = false;
            alarm_set(1,-1);
        }
    }
    Paige Animation end:
    Code:
    ///For death scene
    if(State == e_state.dead){
       ...
    }else if(State == e_state.brawling){
        can_switch_stage = true;
        alarm[1] = 10;
    }
    Paige Sprites
    Code:
    if((!is_hurt) && (State != e_state.dead) && (State != e_state.blocking) && (State != e_state.brawling)){
      ...
    } else if(is_hurt){
        sprite_index = Paige_Hurt;
    } else if(State == e_state.dead){
        sprite_index = Paige_Dead;
        image_speed = 0.2;
    } else if(State == e_state.blocking){
        sprite_index = Paige_Blocking;
        image_speed = 0.03;
    } else if(State == e_state.brawling){
        image_speed = 0.2;
        sprite_index = brawl[stage];
        if (can_switch_stage){sprite_index = Paige_Idle;}
    } 
    I feel like I'm doing something terribly wrong with the alarms, as I've tried three different methods (all of which have failed). Thanks for the support; any help is appreciated!
     
  2. Carl Nylander

    Carl Nylander Member

    Joined:
    Jul 21, 2016
    Posts:
    212
    Hi! I don't know if this is the issue but it's at least some kind of problem.
    In Paige_Brawl you define clicks with var:
    var clicks = 1;
    You then increase it with 1 and never use it.
     
  3. Thank you for your reply :) What should I do with this information?
     

Share This Page