How do I Deal with Speed Boost Issue

0 favourites
  • 8 posts
From the Asset Store
Have you ever dreamed of playing in a Speedball game or tournament?
  • Unfortunately I don't have enough reputation posts to post my capx file but I'm working on a project (first time making a game) that is an "endless running" style game that avoids oncoming cars and obstacles (Birds eye view). I tried to implement the option to have the main character have a boost in speed when the user presses the spacebar.

    When spacebar is pressed, i increase the animation speed, increase 8direction speed/acc/dec, wait 5 seconds, and then set them all back to their previous values. I'm thinking there's a better way to do this using some kind of timer, but this is what I've got.

    The problem, is that when the user presses space bar, my character immediately turns to the right (east), and then when the 5 seconds is up and the speed/acc/dec goes back to original values, he sort of does a lunge.

    I'm hoping this is an obvious problem that I've overlooked. Thanks again!

  • You want a Gradual decrease in speed which you can achieve by deceleration.

    On Spacebar pressed |Set Player.8-Direction.MaxSpeed to (Your max spd)

    Every Tick, Player.8-Direction.MaxSpeed > (Your min spd)| Set Player.8-Direction.MaxSpeed to Player.8-Direction.MaxSpeed/1.01

    There. Just adjust the 1.01 value up and down. Try 1.001 - 1.04 range and see what works best for you.

  • Thanks for such a prompt response. I'll have to try this out when I get home. Any ideas on why the sprite faces to the right?

  • Try https://www.dropbox.com/s/3gelkszlyl6e2 ... .capx?dl=0

    To get a sprite to face where you want to. I can't really tell what you want your character to look like but this capx, my character switches animation for each direction he is facing.

    If it's a top-down perspective like a zombie shooter type then you should check out the built-in ghost shooter example in c2. All you need in that example is to set the character angle.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your animation looks a bit more complicated than what I'm trying to accomplish. I will check out the built-in ghost shooter example now.

    So... I'm not sure if this is allowed, but if your link was tweaked a little bit....i think you'd fine my capx file.

    after the "/s/" mjl5wf1acl3u2g9/lanhoj.capx?dl=0

    Beware there is some loud sound -- the lunge occurs when you hit spacebar and when the timer runs out on the boost. Thanks again!

  • In the series 'Do Not Use Wait For Timings'.

    https://www.dropbox.com/s/k6x23f6s5swt5 ... .capx?dl=0

    Let the behavior take care of the acceleration. It is designed 4 that.

    Pair the animation to the speed.

    The 'Bound to layout' will not 'suddenly' stop the speed in the behavior when the player is reaching the boundary's. So the player looks 'stopped', but the behavior just keeps deacceleration. So .. the speed is not zero. although the player looks like the speed is zero. That is why the player will not intermediately start to move after hitting the a boundary. It will first finish the deacceleration.

    This i why i offer you a better solution for the boundary's.

  • Thanks so much for that! I've tried to implement every change suggested and overall I'm much happier with it. I haven't quite sorted the "wall" out yet -- if I go full force against the left wall, sometimes the player goes through it until it hits the boundary. I'm not sure if there's a setting I missed but it results in the cars being able to drive over him without losing lives.

    Speaking of lives -- any ideas on how to get +1 Health for every 20 points? I can't seem to do it outside of condition 8 without it resulting in a near endless loop.

    Lastly, my spawn method is pretty crummy, but on top of that, if two cars go below the Y threshold simultaneously,

    (to be destroyed and +1 score) it's only counting one of them. Any suggestions on that?

    The file that is linked to has been modified to reflect the changes made: mjl5wf1acl3u2g9/lanhoj.capx?dl=0

  • Ahh -- just realized, I'm now asking questions that may not pertain specifically to the speed boost anymore. Perhaps I should create a new thread?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)