How do I make a "simple" side car game

0 favourites
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • Hi guys...I saw a few samples...but there are a bit too complicated for a beginner.

    Basicly I have a car body + 2 separate wheels ( so 3 sprites)...How can I make the wheels rotating correctly wwhen I use the arrows to drive the car ? I need that the car rotates according to the road that has different agles.

    thanks guys

  • In principle you want something like this.

    [attachment=0:3lyol0st][/attachment:3lyol0st]

    In reality it is more complicated to setup a system that renders good results. Check this similar (but more refined) example on my post in this other topic .

    You will need to install rexrainbow's Light behavior in order to open this one.

  • Thanks...very kind

  • Hi Elios, I have another question...because as beginner it is too hard ....this would better for me:

    I have made a car as one single sprite where the wheels are part of it as a animation...so if i go right or left I set an animation. How can I set that the car geting the angle from my ground in a smooth!!! way like U did on ur sample "get angle from ground" that I saw on ur site ( compliments...great samples)... I need something like that,...but super simple to understand...I am beginner and that is really hard to understand...

    can U please help me ???

    thanks a lot

  • Could you explain what is too difficult about the sample capx eli0s posted, for it seems as easy as it can get..

  • ...uhm... maybe it's me who is too much beginner.... :/ ground angle value ecc...all this things are a bit confusing...

  • You want the car to be the same angle as the ground..

    so you set the car angle to the ground angle, It doesn't get easier than that, I'm sorry..

    ground.angle = the angle of the ground object,

  • thanks...I will try...last question... is there a way to make this angle change gradualy like an animation instead of a hard change from one angle to the other ????

    thanks

  • mariogamer ,

    Setting the animations based on key input is easy, but it won't work as good as using something procedural that takes in to account the Car's acceleration and speed. The event that does that isn't that complicated.

    It goes like this: Every tick---> Set the Wheel's rotation speed to 360 * Car.Platform.VectorX / (2 * pi * Wheel.Width/2).

    Which basically means: Constantly (Every tick)---> Rotate the Wheel (something that is being handled by the "Rotate Behavior") with the angular speed of a full circle (360), multiplied by the Car's moving distance on the horizontal axis (Car.Platform.VectorX), divided by 2 Pi (2 * 3,14), and multiplied by the Wheel's Radius ( Wheel.Width/2).

    In regard to the gradual angle adaptation, I've updated the example to include a way to do it, you can fiddle with the values to get a better result. Also, adding more in-between slopes might help smooth the car's path.

    On a final note, I think that the only way to achieve a good result is to add a suspension mechanism, otherwise it will always look somewhat funky. Perhaps there are other, better and easier ways to make a suspension, other members may input something useful on that subject...

  • That is so kind from Ur side...Thank U so much !!!!!!!!!!!!!

    As beginner all this "formulas" are really hard to understand... but the sample is PERFECT in my opinion ! thank U again so much

    bye

    Mario

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mariogamer , you are welcome!

  • Hi I have another question, how can I make this:

    Imagine a sprite that is the car body, and another sprite is the wheel. The wheel is an animated sprite that turns 360° as animation. ( now U will ask why should I do something like this ? ...I have rendered a wheel with a slight perspective view...it makes impossible to turn it like a pefect circle).

    My question is this : if I pin the wheel to the car like U did in ur capx that u sent me...how can I make the animation of the spinning wheel change it's speed according to the car speed, so that the animation of the weheel looks realistic and not too quick or too slow...also because there is a probabile decelartion, so that the speed canges always a bit ? I hope U understand my insane idea

    thanks a lot

  • It's not that hard actually. You just have to link the vector X of the car to the animation speed. For the reverse rotation a little trick has to be done, Construct doesn't support inverse looping, but this is also easy to tackle.

    I've made an example using the 8direction behavior, but even if you use the platform behavior, the same expressions are available, so it shouldn't be that difficult for you to transfer the logic between the two behaviors.

  • Hi Elios, just wanted to know if U have a capx like the one of the simple car but also with supensions ???

    I install now the last version so I can try the thing with the animation that U told me....

    thanks a lot

  • mariogamer , I'd made an example capx at this topic , I haven't made anything else. Since I saw that you'd already posted there, I didn't thought to mention it here too.

    Please have in mind that you will need to install the Light behavior (made by rexrainbow) in order to open the file.

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