Tutorial by Pvic, Dropdash code by F4LK
Create code for obj_character
so, here is how to add the dropdash to your GMate game: put this in obj_character's create event:
// Drop Dash // use_dropdash = false; // Whether or not the player can perform the homing attack. DropDashFlag = 0; // Used to change the animation. DropDashTimer = 15; // How long it takes to charge the drop dash. DropDashSpeed = 0; // How strong the drop dash is. You will have to add a dropdash animation in scr_sonic_animations_normal
in scr_player_animations_set, replace these jumping animations: https://cdn.discordapp.com/attachments/342648041678962692/398483587135176705/unknown.png
with this:
if(action = ConActJump && animation != "jumping") {animation = "jumping"}; if(action = ConActJump && DropDashFlag = 2 && animation != "dropdash") {animation = "dropdash"}; if(action = ConActNormal && speed_y >= 0 && animation = "idle") {animation = "jumping"};Make a script called scr_player_action_dropdash and paste this in
if action = ConActShield{sound_stop(snd_player_spin_charge);}; if(ground == true && DropDashFlag == 2){ sound_play(snd_player_spin_release); action = ConActRoll; DropDashFlag = 0; DropDashTimer = 15; if((!key_left && !key_right) or (key_right && key_left)){ speed_x = animation_direction*DropDashSpeed; }else{ if(key_left){ speed_x = -DropDashSpeed; }else{ speed_x = DropDashSpeed } } action = ConActRoll; } if(action == ConActJump){ if(!ground == true && DropDashFlag == 0){ if(key_action_pressed){ DropDashFlag = 1; } } if(!ground == true && DropDashFlag = 1){ if(DropDashTimer != 0){ DropDashTimer -= 1 } if(DropDashTimer = 0){ sound_stop(snd_player_spin_charge); sound_play(snd_player_spin_charge); DropDashFlag = 2; DropDashSpeed = abs(speed_x)/2 + 8; // Limit the Drop Dash Strength: if(DropDashSpeed > 13){ DropDashSpeed = 13; } } } } if(DropDashFlag != 0){ if(!key_action){ DropDashFlag = 0; DropDashTimer = 15; DropDashSpeed = 0; } } go to obj_character -> step -> actions and paste this:
//Abilities only for Sonic: if(character = ConCharSonic){ scr_player_action_dropdash() } and that's all folks
.