r543
Relic Team
Posts: 408
|
Post by r543 on Mar 17, 2012 10:51:21 GMT -5
i'm working on my engine(i will upload a youtube video when i added enough things) and i added a jumpdash. the problem is that i want that the jumpdash ends after some seconds and not when i release the button.
|
|
|
Post by XxSuperShadicxX on Mar 17, 2012 11:29:10 GMT -5
A jump dash is just a burst of speed when off the ground.
|
|
r543
Relic Team
Posts: 408
|
Post by r543 on Mar 17, 2012 11:34:37 GMT -5
A jump dash is just a burst of speed when off the ground. yes i know that but i'm making it more colors/advacne style with the speed that doesn't slowdonw that much but with the unleashed gravity
|
|
|
Post by zankuujinmujinsho on Mar 17, 2012 19:34:24 GMT -5
What's your code?
You could always try Input/Pressed/ActionA instead Input/Hold/ActionA
Also, Learn2Caps.
|
|
r543
Relic Team
Posts: 408
|
Post by r543 on Mar 18, 2012 4:21:04 GMT -5
What's your code? You could always try Input/Pressed/ActionA instead Input/Hold/ActionA Also, Learn2Caps. if i use Input/Pressed/ActionA then it doesn't show the animation because the time is too short. the code i use is this: Function Player_Action_Jumpdash(p.tPlayer, d.tDeltaTime) p\Jumpdashspeed = 4 p\Motion\Speed\x# = Sin(p\Animation\Direction#)*p\Jumpdashspeed p\Motion\Speed\y# =0 p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*p\Jumpdashspeed If (Not Input\Hold\ActionB) Then p\Action = ACTION_COMMON PlaySound(Sound_Boostrelease) EndIf If (p\Motion\Ground=True) Then p\Action = ACTION_COMMON EndIf End Function
|
|
|
Post by zankuujinmujinsho on Mar 18, 2012 11:39:11 GMT -5
If (Not Input\Hold\ActionB) Then p\Action = ACTION_COMMON PlaySound(Sound_Boostrelease) EndIf What are you trying to do here? If you aren't holding ActionB then make the action Common? If you're doing the JumpDash, and You're Pressing A, and then A again [While Jumping] then why bring Action B into it?.
|
|
r543
Relic Team
Posts: 408
|
Post by r543 on Mar 18, 2012 12:55:09 GMT -5
If (Not Input\Hold\ActionB) Then p\Action = ACTION_COMMON PlaySound(Sound_Boostrelease) EndIf What are you trying to do here? If you aren't holding ActionB then make the action Common? If you're doing the JumpDash, and You're Pressing A, and then A again [While Jumping] then why bring Action B into it?. i made the jumpdash on the button/action B. i will change it . If you release the mouse it changes to Action Common and Action Common changes to Action Fall.
|
|
|
Post by CarrierHack on Mar 18, 2012 15:06:16 GMT -5
Try replacing "If (Not Input\Hold\ActionB) Then" with "If (Input\Hold\ActionB = False) Then" It's basically the same thing but it's worth a shot. Nothing seems wrong to your code to me.
|
|
r543
Relic Team
Posts: 408
|
Post by r543 on Mar 19, 2012 4:16:24 GMT -5
Try replacing "If (Not Input\Hold\ActionB) Then" with "If (Input\Hold\ActionB = False) Then" It's basically the same thing but it's worth a shot. Nothing seems wrong to your code to me. That does the same thing. i want it like in arrows mod or bsu, the jumpdash was going forward for some seconds and then it ended. i want to know how to add a code that it ends after a time
|
|
|
Post by Gistix on Apr 5, 2012 12:17:15 GMT -5
Hmmmm, use the Millisecs() code, and you will control the time that you want to he going forward
|
|
|
Post by 06hypersonic60 on Apr 5, 2012 13:49:13 GMT -5
blah blah blah. It's so simple: Use the delta time -.- And I also suggest adding a Fall Action. It will really help. If I was you I would never use ACTION_COMMON to end the jump dash. Then, Here's the best way to code it go to the jump action and add this: If (Input\Pressed\ActionA) Then p\Action = ACTION_DASH p\Motion\Speed\x#= Sin(p\Animation\Direction#)*3*Game\Deltatime\Delta p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*3*Game\Deltatime\Delta PlaySound Sound_Dash
and make a new action and name it ACTION_DASH then add the Delta time code like this: DashTime =DashTime+(game\deltaTime\timeCurrentFrame-Game\DeltaTime\TimePreviousFrame) If DashTime > 500 Then p\Action = ACTION_FALL2 : DashTime = 0 If (p\Motion\Ground = True) Then p\Action = ACTION_COMMON : Fall= 0 Finally add a variable like this: Global DashTime =0 Hope this helps ;D
|
|
r543
Relic Team
Posts: 408
|
Post by r543 on Apr 6, 2012 12:23:34 GMT -5
blah blah blah. It's so simple: Use the delta time -.- And I also suggest adding a Fall Action. It will really help. If I was you I would never use ACTION_COMMON to end the jump dash. Then, Here's the best way to code it go to the jump action and add this: If (Input\Pressed\ActionA) Then p\Action = ACTION_DASH p\Motion\Speed\x#= Sin(p\Animation\Direction#)*3*Game\Deltatime\Delta p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*3*Game\Deltatime\Delta PlaySound Sound_Dash
and make a new action and name it ACTION_DASH then add the Delta time code like this: DashTime =DashTime+(game\deltaTime\timeCurrentFrame-Game\DeltaTime\TimePreviousFrame) If DashTime > 500 Then p\Action = ACTION_FALL2 : DashTime = 0 If (p\Motion\Ground = True) Then p\Action = ACTION_COMMON : Fall= 0 Finally add a variable like this: Global DashTime =0 Hope this helps ;D action common checks if there is collision with solid things if not it changes to fall. thanks for the help people.
|
|
|
Post by CarrierHack on Apr 6, 2012 15:12:07 GMT -5
blah blah blah. :P It's so simple: Use the delta time -.- And I also suggest adding a Fall Action. It will really help. If I was you I would never use ACTION_COMMON to end the jump dash. Then, Here's the best way to code it go to the jump action and add this: If (Input\Pressed\ActionA) Then p\Action = ACTION_DASH p\Motion\Speed\x#= Sin(p\Animation\Direction#)*3*Game\Deltatime\Delta p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*3*Game\Deltatime\Delta PlaySound Sound_Dash
and make a new action and name it ACTION_DASH then add the Delta time code like this: DashTime =DashTime+(game\deltaTime\timeCurrentFrame-Game\DeltaTime\TimePreviousFrame) If DashTime > 500 Then p\Action = ACTION_FALL2 : DashTime = 0 If (p\Motion\Ground = True) Then p\Action = ACTION_COMMON : Fall= 0 Finally add a variable like this: Global DashTime =0 Hope this helps ;D ..what are you doing. 1. Don't multiply p\Motion\Speed\x#|y# with deltatime. They are already multiplied by deltatime when 'applied' to Sonic (Player_Motion.bb, look up MoveEntity(p\Objects\Entity). Doing this will only mess things up. 2. Adding more unnecessary functions won't help. Never. You'll only end up having 20+ functions, of which half will be unnecessary. It'll make your code messy (IMO, at least). Thing like a jump dash can have an seperate action, however, a simple If (Input\Pressed\ActionA) Then p\Motion\Speed\x#= Sin(p\Animation\Direction#)*#SPEED# p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*#SPEED# PlaySound Sound_Dash EndIf
Is more than enough. If you want it more advanced, as in, last for a few seconds, you need to use a timer + function (Unless you want to make it unnecessarily complicated - yes, use functions if necessary). Do the following: 1. Add a Global somewhere (I usually make a Globals.bb in the _SourceCode directory), call it something like 'Timer1#' 2. Add a seperate function, not going to explain that :p 3. In ACTION_JUMP, add code like this: If (Input\Pressed\ActionA) Then p\Motion\Speed\x#= Sin(p\Animation\Direction#)*#SPEED# p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*#SPEED# PlaySound Sound_Dash ;If you want to use a sound Timer1# = MilliSecs() + #TIME# ;Replace #SPEED# with your speed :p ;Replace #TIME# with the time you want the jump dash to take, in milliseconds (1000ms = 1s, so the amount of seconds multiplied by 1000) p\ACTION = ACTION_DASH EndIf
This'll give you a speed boost if you hit the button again, play the sound (if you want), set of the timer, and change your action to ACTION_DASH 4. In ACTION_DASH, add the following code, p\Motion\Speed\y# = 0 ;This'll make Sonic not go down, like in 'em gaimz p\Motion\Speed\x#= Sin(p\Animation\Direction#)*#SPEED# p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*#SPEED# ;Will make Sonic keep going forward If (p\Motion\Ground = True) Then p\Action = ACTION_COMMON ;If the ground is hit, end jumpdash, go back to ACTION_COMMON If (Timer1# < MilliSecs()) Then p\Action = ACTION_COMMON ;If the Timer1# is smaller than MilliSecs(), so if it ran out, go back to ACTION_COMMON, jumpdash time is over).
Sonic will still be able to controlled while going forward in the jump dash though... If you don't want that; 5. Lock out the check-if-direction-changed. In Player_Management.bb, you have this: Select Gameplay_Control_Mode Case PLAYER_MODE_MOUSELOOK MotionDirection# = p\Objects\Camera\Rotation\y#-Input\Movement_Direction# MotionPressure# = Input\Movement_Pressure# Case PLAYER_MODE_ANALOG MotionDirection# = p\Objects\Camera\Rotation\y#-Input\Movement_Direction# MotionPressure# = Input\Movement_Pressure# Case PLAYER_MODE_SRB MotionDirection# = p\Objects\Camera\Rotation\y#-90*Input\Movement_AnalogY# MotionPressure# = Input\Movement_Pressure#*Abs(Input\Movement_AnalogY#) End Select
at the top. This makes it check if the direction changed. To make it not do this if Sonic's jump dashing, add an 'If p\ACTION = ACTION_DASH = False then' in front of each of 'em, like so: Select Gameplay_Control_Mode Case PLAYER_MODE_MOUSELOOK If (p\Action = ACTION_DASH = False) Then MotionDirection# = p\Objects\Camera\Rotation\y#-Input\Movement_Direction# MotionPressure# = Input\Movement_Pressure# EndIf Case PLAYER_MODE_ANALOG If (p\Action = ACTION_DASH = False) Then MotionDirection# = p\Objects\Camera\Rotation\y#-Input\Movement_Direction# MotionPressure# = Input\Movement_Pressure# EndIf Case PLAYER_MODE_SRB If (p\Action = ACTION_DASH = False) Then MotionDirection# = p\Objects\Camera\Rotation\y#-90*Input\Movement_AnalogY# MotionPressure# = Input\Movement_Pressure#*Abs(Input\Movement_AnalogY#) EndIf End Select
- I'm pretty sure this should do the trick. I can't guarantee it though, as I did not test it out by myself, I think this should work (And I give advice more often without even opening Blitz3D, I'm not shouting stuff like I'm retarded). ~My 2 cents.
|
|
|
Post by 06hypersonic60 on Apr 6, 2012 16:11:25 GMT -5
nice code there. and I multiplied the speed with delta time just for test and forgot to remove it. didn't change anything anyways
|
|
|
Post by 06hypersonic60 on Apr 6, 2012 16:16:08 GMT -5
blah blah blah. It's so simple: Use the delta time -.- And I also suggest adding a Fall Action. It will really help. If I was you I would never use ACTION_COMMON to end the jump dash. Then, Here's the best way to code it go to the jump action and add this: If (Input\Pressed\ActionA) Then p\Action = ACTION_DASH p\Motion\Speed\x#= Sin(p\Animation\Direction#)*3*Game\Deltatime\Delta p\Motion\Speed\z# = -Cos(p\Animation\Direction#)*3*Game\Deltatime\Delta PlaySound Sound_Dash
and make a new action and name it ACTION_DASH then add the Delta time code like this: DashTime =DashTime+(game\deltaTime\timeCurrentFrame-Game\DeltaTime\TimePreviousFrame) If DashTime > 500 Then p\Action = ACTION_FALL2 : DashTime = 0 If (p\Motion\Ground = True) Then p\Action = ACTION_COMMON : Fall= 0 Finally add a variable like this: Global DashTime =0 Hope this helps ;D action common checks if there is collision with solid things if not it changes to fall. thanks for the help people. that depends on coding a falling code to play the animation or the current anim will be played
|
|