How do I create a dash in a game that scrolls?

Get help using Construct 2

Post » Tue Jun 18, 2013 6:27 am

Im making a runner and similar to Robot Unicorn attack I am trying to program in a dash. Problem is regular stuff like acceleration causes issues where he'll jolt forward but due to scrolling in the runner he wont go far. Move to functions cause a jolting teleport and the screen scroll cannot keep up with the player allowing for players to dash off screen.

I'm looking for a smooth horizontal dash that I can adjust the distance on until it feels right and that the camera will be able to keep up with. If I get a dash and the camera slowly loses ground to the player allowing the player to march further and further to the right its not good in a runner. Ideally I need the runner to always stay framed in the same area of the canvas and for the dash to just sort of jolt him forward noticeably. If I need to add the code to the world so that it dashes to the left horizontally to create the illusion of him dashing to the right then I will.

Please I'm really stuck on this as I'm fairly new. If anyone has made a runner and has a functional dash similar to Robot Unicorn's it would be MUCH appreciated.
B
3
Posts: 6
Reputation: 237

Post » Wed Jun 19, 2013 11:27 pm

Hi shaowebb,

If you're using the platform behavior, you could change the max speed parameter of the behavior in an action, then set the vector x (and vector y if you want a slight jumping or hopping effect) to a number higher than the max speed... But just make sure to set the max speed back after x seconds.

Hope that helps.

Edit: Could also make a boolean for when he is dashing to prevent "infinite dashing".
exkage2013-06-19 23:36:15
B
4
S
1
Posts: 13
Reputation: 376

Post » Sat Jun 22, 2013 1:33 am

Thanks for the help, but its not working either. As before he jolts forward only slightly and then goes straight back down after coming to a very short and sudden stop in midair. I can get some interesting effects messing with gravity though, but he doesn't accelerate nearly as fast as I want him too when he does it.

Any idea how to setup an action that reverts the gravity back to its original value after so much distance? Maybe I can cheese it by adding the action of gravity angle =1 and gravity strength =25000 after you hit dash if I can set it to revert back after so much distance.
B
3
Posts: 6
Reputation: 237

Post » Sat Jun 22, 2013 2:33 am

Okay tried the gravity angle+ max fall strength and all that and you get sort of a superman thing. You stop, move back a bit, then accelerate off the screen.

I'm thinking I'm going about this the wrong way...what if the dash wasn't me adjusting platform actions like vector X and Vector Y....what if I used the physics actions to apply a force? Any thoughts on this?
B
3
Posts: 6
Reputation: 237

Post » Sat Jun 22, 2013 7:44 am

Platform and Physics do not interact with each other.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,568

Post » Sat Jun 22, 2013 2:08 pm

Most I could get with physics by adding them to my character's behaviors was stuff like impulse to cause him to jolt forward similar to "move to" actions and torque to cause him to spin (dont know why I thought I could do much with torque).

Got any ideas folks. I really need to get that dash functioning in this running game and its not working.shaowebb2013-06-22 14:09:04
B
3
Posts: 6
Reputation: 237

Post » Fri Jun 28, 2013 5:47 am

Anyone? I'm open to suggestions here. You can load the template runner to see what I'm talking about, but dashes dont seem to go that far. I could really use some help setting up one similar to the robot unicorn attack dash.
B
3
Posts: 6
Reputation: 237

Post » Fri Jun 28, 2013 6:53 am

Hey,

The solution to change the max speed and use a boolean to know if dashing or not seemed to be the good way to go.
Here are the parameters that are to be tested :
- dashing speed : how fast the NPC goes when dashing
- dashing duration : not really its duration, but the coefficient to apply to "deceleration" during dashing, as default settings would create a very short dash.
- running speed : the base speed to go back to once dashing is complete.
Now let's think about the events. If an input is detected, if it's "space bar" (example), then player dashes if he wasn't already. If it's anything else, he jumps.
How to know when the dashing is finished ? I used the fact that the player speed was at that point below the running maximal speed (and had landed), so the transition should be smouth.

Here is how it goes in a capx.
B
17
S
8
G
4
Posts: 461
Reputation: 6,097

Post » Fri Aug 30, 2013 1:39 am

This looks pretty good thanks! Sorry it took so long to reply...I was coding other areas and had essentially lost hope thinking this had died here. Glad it didnt!

Odd thing is when I input SYSTEM EVERY TICK SCROLL Y to PLAYER.Y

The screen fails to track the player in this file for some reason. Any clue why its not able to scroll and Track? Am I putting the event in the wrong area?

If I get the camera and the dash to work in tandem then I'll have all I need to carry onward here. I may have to code a delay into the camera Scroll if it causes the dash to look wrong, but its my safety net to use the camera scroll to prevent dashing out of the game window.
B
3
Posts: 6
Reputation: 237


Return to How do I....?

Who is online

Users browsing this forum: Darknessed, FabianB and 8 guests