How do I simulate "realistic" tank movement?

Just started using Construct 2? Post your questions here

Post » Sat May 07, 2016 4:57 pm

First off, hello! New member here :)

And the question... how do I emulate tank's hull movement in top-down perspective?

To sum it up, I need my tank to:

    Pivot on the spot by pressing A and D key,
    Accelerate forward when pressing W,
    Reverse when pressing D,
    and moving forward/backwards while turning should make the tank behave somewhat like a turning car, but with adjustable angle of turn.

How do I achieve this?
B
3
Posts: 3
Reputation: 177

Post » Sat May 07, 2016 10:48 pm

Set up your object with "Car" and "Rotate" behaviors.

For the car behavior, you'll want to turn off default controls. Set up your W and S to simulate "accelerate" and "brake".

Set the rotate speed with A and D, one positive one negative. Make sure you have an "else" event after that sets speed back to 0, so when your keys are not down it stops rotating.

Image
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Mon May 09, 2016 9:23 am

Thanks for the reply @oosyrag !

This method works, but I feel that the movement is still somewhat slidey, especially while turning. I need this to not happen.
What I want to happen when I release the W or S key is that the "tank" stops moving almost immediately, with only a few... say 20 pixels of "slide distance".

Another thing I'm still confused about in the Car behavior is the relation of "deceleration" and "brake" (or reversing?). What I mean is that I'm not sure how I can control my braking force so that it still take some time to decelerate when I release W/S key, but comes to full stop almost immediately upon pressing the opposite key (i.e. pressing S while moving forward (W) and vice versa). How do I make it like so?

This is what I've tried so far. It controls like a tank, but it still doesn't move quite like a tank, if you know what I'm saying.

Image

I think at this point I should also mention that I want the movement to be a lot like a top-down version World of Tanks, or War Thunder.
B
3
Posts: 3
Reputation: 177

Post » Mon May 09, 2016 9:30 pm

I see what you mean, maybe we should scrap that idea then.

Here's something I put together without any behaviors. I've added some constraints and used dt where I remembered to, so it should be fairly future proof. Hope you can modify it to suit your needs, or figure something out using it as a basis.

https://www.dropbox.com/s/4aoihmvl0h4s1 ... .capx?dl=0


I feel pretty sure there is a cleaner way to do this, but it is what I came up with off the top of my head. Maybe someone else can provide a better way.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Wed May 11, 2016 9:28 am

Hello @oosyrag, thank you again for the reply!

This seems to work quite right. Though I'm still curious about the Custom Movement function. Perhaps this system could be done with that function and more, but of course I have to learn it first haha :P

Thanks for the help @oosyrag! If someone else has different approach to this problem, please do post it here! I'm always eager to learn :)
B
3
Posts: 3
Reputation: 177


Return to Beginner's Questions

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests