Tank Movement

Just started using Construct 2? Post your questions here

Post » Sat Oct 24, 2015 8:30 pm

Hi! I recently began using Construct 2 and am loving it.

I'm creating a top-down game in which the player controls a tank. I need to use physics. However, I have a problem. If I use forces and torque to move the tank, it drifts, even though the linear and angular dampening are set to 1. Using Set Velocity and Set Angular Velocity works for driving the tank, but causes issues when it interacts with other objects.

Is there a way to use forces and torques to move the object, but simulate friction with the floor so it doesn't drift while driving?

Thank you!
B
3
Posts: 3
Reputation: 183

Post » Mon Oct 26, 2015 8:03 am

Today I tried simulating friction through code:

System -> Every Tick -> Tank -> Apply Force -> X: -0.1 * Tank.Physics.VelocityX, Y: -0.1 * Tank.Physics.VelocityY
System -> Every Tick -> Tank -> Apply Torque -> -BlueTank.Physics.AngularVelocity

It's progress, but I still can't eliminate the drift and I'm sure there's a more elegant method.
B
3
Posts: 3
Reputation: 183

Post » Mon Oct 26, 2015 8:11 am

It might be my limited imagination, but what is the benefit of using the physics behaviour on a top-down game?

As a tank can only move forward in the direction it is facing, you could probably incorporate that in your events..
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 » Mon Oct 26, 2015 9:11 am

Much of the game involves the tanks pushing objects and their motion needs to be affected when they collide into each other, are shot or collide with an immovable object.

Thank you for your input. Only allowing the tank to move along its forward/backward axis is a good idea. I'll play around with it.
B
3
Posts: 3
Reputation: 183


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests