About the car movement

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Race with others on this challenging road and become the best!
  • I was trying to create my custom car movement so there would be no more bounce but as I was translating my Flash code into Scirra, everything went wrong and it pretty much failed.

    I have a few questions because of this:

    1)Can you get rid of the 'bounce off walls' feature on the Car Behavior?

    2)When you use a 'if key down' statement, does everything in that code occur constantly? I put 'if left is down, add 5 to the speed variable'. That would continuously add 5, correct?

  • 1) You could do that with Events. Can't think of the needed events off the top of my head though

    2) Yes. As long as the condition(s) is/are true it will perform the actions. In this case as long as the Left button is down it would add 5 to the variable 'speed'.

  • 1) You could do that with Events. Can't think of the needed events off the top of my head though

    2) Yes. As long as the condition(s) is/are true it will perform the actions. In this case as long as the Left button is down it would add 5 to the variable 'speed'.

    1)Okay, I'll see if I can build some behaviors to make it work.

    2) Okay, so it will keep increasing if it's held down (5,10,15) correct?

  • I haven't tried car behavior, so moving on to 2: Yes, "if key down" works like that. As opposed to "key pressed" which triggers only once.

    Hmm, actually, about 1: It looks like doing

    Sprite ("car" tab) 'On bounce' for a condition, and Sprite ("car" tab) 'Stop' for the action stops the bouncing nicely.

  • I haven't tried car behavior, so moving on to 2: Yes, "if key down" works like that. As opposed to "key pressed" which triggers only once.

    Hmm, actually, about 1: It looks like doing

    Sprite ("car" tab) 'On bounce' for a condition, and Sprite ("car" tab) 'Stop' for the action stops the bouncing nicely.

    Ah, number one works (except it 'sticks' but that's fine, expected with stop) and 2) I forgot if key down even though I wrote it, I wrote key pressed

    Problem solved, thanks to everyone who helped!

    EDIT: Anyone know how to not make it 'stick' or only make it stop it on the first hit? I tried to find a 'decelerate' expression thingy but didn't seem to find one.

  • Maybe something like

    Sprite: On bounce

    System: Compare, Sprite[Car].Speed Greater Than 100

    Action > Sprite: Stop

    Or maybe using "Set speed" in the car tab.

  • Maybe something like

    Sprite: On bounce

    System: Compare, Sprite[Car].Speed Greater Than 100

    Action > Sprite: Stop

    Or maybe using "Set speed" in the car tab.

    Hm, I couldn't get your first idea to work, but set speed just makes it keep moving along the axis where it hit (aka it does slow it down but it keeps moving without input)

  • You might want to check out the custom movement behavior.

  • blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).

  • blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).

    Do you want a tutorial on how to get the car to stop when it hits something?

    I did some research yet still don't know what the custom movement behavior exactly is.

  • Its just like the car movement, except there's more... way more. You can still do bounce, but not if you don't want to. It handles acceleration, variable turning radius, brake distance, heck you can even have spin outs.

  • > blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).

    >

    Do you want a tutorial on how to get the car to stop when it hits something?

    Better two things: how to stop while hitting something and how to lower bouncing.

    By the way, can anybody explain a strange behavior in car movement. I have a sprite named "Mycar", it has "car behavior" movement, no any coding. The result - the car can move back repeatedly even after one press-and-release of a key, assigned to a back movement. Compare with moving forward: press key - moving, release key - lowering speed and finally stop. Repeat again - no any additional coding was done by me! It's abnormal!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • >

    > > blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).

    > >

    > Do you want a tutorial on how to get the car to stop when it hits something?

    >

    >

    Better two things: how to stop while hitting something and how to lower bouncing.

    By the way, can anybody explain a strange behavior in car movement. I have a sprite named "Mycar", it has "car behavior" movement, no any coding. The result - the car can move back repeatedly even after one press-and-release of a key, assigned to a back movement. Compare with moving forward: press key - moving, release key - lowering speed and finally stop. Repeat again - no any additional coding was done by me! It's abnormal!!!

    Well, stop when hitting something is simply like this (in the construct event sheet):

    On car bounce (this is found in the car tab when you right-click and add a event)

    -Stop car (found on car event as well as a sub-event)

    With the default car movement, I don't think you can change it since it depends on the speed in which it hits.

  • blankedt, well...it works. ) - it can move back after one key pressing - with the same speed. I supposed, that built-in behaviors of moving back and moving forward should be similar or the same. In Construct - no. Why??? Is this bug?

  • blankedt, well...it works. ) - it can move back after one key pressing - with the same speed. I supposed, that built-in behaviors of moving back and moving forward should be similar or the same. In Construct - no. Why??? Is this bug?

    Just try deleting the car movement (remove the behavior) and try again. That or you might have a bug (you are using the latest version, right?)

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