How do I make a "simple" side car game

Get help using Construct 2

Post » Thu Aug 21, 2014 9:07 pm

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 :)
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Fri Aug 22, 2014 1:30 am

In principle you want something like this.
Wheels.capx

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 viewtopic.php?f=147&t=109637.
You will need to install rexrainbow's Light behavior in order to open this one.
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Fri Aug 22, 2014 4:32 am

Thanks...very kind :)
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Fri Aug 22, 2014 5:54 am

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
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Fri Aug 22, 2014 6:40 am

Could you explain what is too difficult about the sample capx @eli0s posted, for it seems as easy as it can get..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Aug 22, 2014 7:10 am

...uhm... maybe it's me who is too much beginner.... :/ ground angle value ecc...all this things are a bit confusing...
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Fri Aug 22, 2014 9:31 am

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,
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Aug 22, 2014 9:48 am

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 :)
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Fri Aug 22, 2014 12:25 pm

@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...
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Fri Aug 22, 2014 3:03 pm

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
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 26 guests