[Behavior] Car physics

Post your completed addons to share with the community

Post » Tue Apr 01, 2014 5:41 am

CodeMasterMike wrote:@Raganork

Easiest way I can think of at the moment, is to set a image of one car as a animation frame, so you'll have 2 different frames with 2 different images, and then when you want to switch image, you change the current animation frame. But there is surely other and better ways to do it.



I did the same, but that is causing the problem. Can't change the sprite. I am not getting why just changing the sprite is causing the problem.
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Fri Apr 04, 2014 1:05 pm

@Raganork Yes, I tried it to now, and it didn't work. Most probably because the collision box gets changed or something like that.

You could also try to have a dummy image above your car image, which is just a image without any collisions. So that this dummy image overlaps the car image. And set the dummy image as a child of the car. That way you dont need to mess with the car physics or its image at all.
B
38
S
13
G
9
Posts: 151
Reputation: 8,427

Post » Fri Apr 04, 2014 1:22 pm

CodeMasterMike wrote:@Raganork Yes, I tried it to now, and it didn't work. Most probably because the collision box gets changed or something like that.

You could also try to have a dummy image above your car image, which is just a image without any collisions. So that this dummy image overlaps the car image. And set the dummy image as a child of the car. That way you dont need to mess with the car physics or its image at all.


Idea is good, but what is the dummy image size is less than original image, or some part coming out, it will not look good. There should be a solution.
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Sat Apr 05, 2014 12:55 pm

@Raganork Beside using a second car or using a dummy image, there is no sollution as far as I know. Its because of the way the Physics works and is build into Construct. When changing the image some things gets recalculated/changed/updated and the physics break apart.

And if you read the [issues] mark at the main post, I explain that there is no way for me to catch a rebuild call.
Maybe in the far future when I have time to work on my plugin/behaviour projects again, maybe I can find a sollution. But that will not happen in the next coming years. All plugins/behaviours are open source, so if you know your way around javascript, you can always try to improve the behaviour yourself.
B
38
S
13
G
9
Posts: 151
Reputation: 8,427

Post » Sat Apr 05, 2014 8:10 pm

CodeMasterMike wrote:@Raganork Beside using a second car or using a dummy image, there is no sollution as far as I know. Its because of the way the Physics works and is build into Construct. When changing the image some things gets recalculated/changed/updated and the physics break apart.

And if you read the [issues] mark at the main post, I explain that there is no way for me to catch a rebuild call.
Maybe in the far future when I have time to work on my plugin/behaviour projects again, maybe I can find a sollution. But that will not happen in the next coming years. All plugins/behaviours are open source, so if you know your way around javascript, you can always try to improve the behaviour yourself.


@CodeMasterMike: Hey.. guess what ? I succeed in finding a workaround.
What I did is, instead of keeping the body on layout, i created it on run-time. And succeed in using two different cars for two levels. It's maybe not a proper solution, but will work for me. So, I thought to share it for others facing same problem.
Her's the link to capx for reference- goo.gl/uNcDVW
B
6
S
2
G
1
Posts: 77
Reputation: 708

Post » Wed Jun 24, 2015 8:58 am

Hello Please help your example demo not working with TopDown_Car_Physics_0.1_tutorial Construct2 last stable version
Error javascript Please help
https://www.dropbox.com/s/mcs10wfalv02o ... 3.png?dl=0

Thank you
@CodeMasterMike
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Sun Jul 26, 2015 5:50 pm

@kantin,

The issue is with the updated "Box2D asm.js" not being compatible with CarPhysics behavior (v0.1).

In order to run the tutorial successfully in newer Construct 2 revisions (including r210 beta), just close the "SideView_Car_Physics_0.1_tutorial.capx" project (if you have it opened) and then open it again *but* do not preview it just yet.

Change the "Physics engine" project property to "Box2D web" instead of "Box2D asm.js". This option can be found by clicking the folder name "New project" in the Projects tab (within the Project Bar view). Now you should be able to preview it.

By default Construct 2 only loads runtime scripts when previewing a project for the first time. So if you previewed the tutorial first before changing to "Box2D web", changing it later doesn't help, as the previous runtime scripts are not updated -- unless you close the project and open it again that is.

EDIT: This wasn't a problem for C2 revisions 196 and below.
B
10
Posts: 5
Reputation: 360

Post » Wed Jul 29, 2015 7:25 am

Thank you thank you thank you @fuego96
I check directly :)
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Tue Jan 12, 2016 8:46 am

Thank you for sharing this behavior with us :)

I wonder why the car seems to break while steering. Can I fix this with some settings, or need to change the code?

xeed
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Wed Aug 17, 2016 11:48 pm

So... is this dead? 403 error....
B
46
S
15
G
3
Posts: 199
Reputation: 4,584

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests