ZFG Posted March 20, 2009 Report Share Posted March 20, 2009 Ok, so I've been trying to add Spindash for a while now, but it with no sign of luck. Here is the code: // Ducking if KEY_DOWN && action=0 && ground && hsp=0 //(Always remember to set required action in order to perform other action) {action=2} else if action=2 && not KEY_DOWN {action=0} //Roll if KEY_DOWN && abs(hsp)>0.3 && ground && action=0 {action=3 angle=0 sound_play(sndRoll)} //Play rolling sound here else if action=3 && abs(hsp)<=0.3 {action=0} //Friction control while rolling if action=3 && ground { if angle=0 or angle=180 //If on flat ground, add friction {hsp-=xdir*0.1} else if xdir=1 && angle>0 && angle<180 //If going uphill going right, add friction {hsp-=xdir*0.1} else if xdir=-1 && angle<=360 && angle>180 //If going uphill going left, add friction {hsp-=xdir*0.1} else {hsp+=xdir*0.1} //If going downhill, reduce friction //Set a speed limit while rolling if action=3 {hspm=hspl} //Set max running speed to speed limit else {hspm=12} //Reset max running speed //If rolling in air, set to jump if action=3 && ground=0 {action=1} //Spin dash (must be ducking first) if action=2 && KEY_A //Start spindash {spin+=1 action=4 sound_play(sndSpindDash)} //Play spindash sound here if spin>0 && action=4 && KEY_A //Charge up spin dash {spin+=1 sound_play(sndSpindDash)} //Play spindash sound here as well if spin>6 //Set spin limit {spin=6} if spin>0 && not KEY_DOWN //Take off from spindah {hsp+=xdir*spin*4 spin=0 action=3 sound_play(sndTakeoff)} //Play take off sound here }[/CODE]This is my Spindash code for objSonic, though when I run the game it won't work. Any idea of anything wrong in this code? Link to comment Share on other sites More sharing options...
mattt360 Posted March 27, 2009 Report Share Posted March 27, 2009 thats a lot of code...if i was you i'd just find an engine with spindash already in it. Link to comment Share on other sites More sharing options...
Recommended Posts