I intend to make a combo system like Devil May Cry 3 (meaning, combo attacks like
E-(pause)-E-E, and directional attacks like
backward+E, assuming E is the melee attack button). Right now my pseudocode for the first combo is the following:
var combo_frames = 60 var hitbox_show_frame = 24 var pause_threshold = 45 var hitbox_show_dur_in_frames = 6 var hitbox_consumed = false var current_frame = 0 var hitbox_show_curr_frame = 0 func _physics_process(delta): #Godot2D's fixedUpdate() current_frame += 1 if current_frame >= hitbox_show_frame and not hitbox_consumed: hitbox_coll.disabled = false if current_frame >= hitbox_show_frame + hitbox_show_dur_in_frames: hitbox_coll.disabled = false hitbox_consumed = true if frame_num >= combo_frames: combo_index = 0 return Melee_Idle.new() pass func _input(event): if hitbox_consumed: if current_frame < pause_threshold: return Melee_Combo2.new() #normal combo elif current_frame < combo_frames: return Melee_Combo2_Alt.new() #alternate combo after some delay
As seen, I've implemented a Finite State Machine for the combo system.
However, I don't have the animation sprites for these combos yet, so the frame numbers are just approximations. Should I get or make said animation sprites before designing this combo system, or can I think about it later and use the frame count like above for now?