How do I control player animation smoothly with tilt

Get help using Construct 2

Post » Mon Oct 10, 2016 7:59 pm

In the infinite jumper template i added a mirrored/ not mirrored animation to the Touch gamma events. It does what it's supposed to do, but the animation jerks too much.

If the tilt is barely a few degrees either way, the player's animation jumps left to right or vice versa erratically. Anyway to calm this down a bit and make it a bit smoother?

Thanks for any input with this.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Oct 10, 2016 8:38 pm

It sounds like the mirrored is what is causing the jerking—is the origin in the middle of the sprite?

I assume the mirroring is done from the origin, so the closer the origin is to the center of the sprite the smoother the toggling of the mirroring should be.
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Mon Oct 10, 2016 10:39 pm

Thanks for reply, @badmoodtaylor

Yes, the origin is in the correct place.

When jumping, if you tilt just a small fraction it's like he can't decide which way to go. Like he's shaking from left to right.

I was thinking it has to do with the gamma numbers, but if i increase them too much he becomes sluggish.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Tue Oct 11, 2016 9:33 am

You should consider to have a dead zone like on gamepad.

I guess you are having your animation change action happen if the tilt is between value A and value B.
Make sure that A is further from 0 (or from the origin value) to prevent the animation change to happen too often (the player has to tilt the device intentionally in a specific direction).

Add such an offset in the other direction as well, and possibly to any other direction you would need.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,295
Reputation: 70,795

Post » Tue Oct 11, 2016 11:29 am

What type of movement behavior? How do you have it setup/what are your events?

Consider posting screenshot of what is happening and/or your events so it is easier to help you.
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Tue Oct 11, 2016 12:14 pm

Thanks for the tip, @Kyatric i'll check that out.

@badmoodtaylor i am using the infinite jumper demo. Everything is the same except i added mirrored/ not mirrored animation to the Touch Events with the gamma logic... simulate pressing left - set mirrored...

Oh, i did increase the numbers from -8, 8 to -10, 10.

That and i added a scoring system.

Nothing much more than that.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Tue Oct 11, 2016 1:22 pm

But I'm still not sure what this means exactly:

jeffige wrote:... the animation jerks too much.


This is your original question/problem and it is still unclear. That's why I suggest posting an animated gif of it—probably easier to see than describe.
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Tue Oct 11, 2016 1:30 pm

And if it is the 'animation' jerking too much, not the sprite's location, I would still think it has to do with the origin. Did you check the origin on every frame of the animation?
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Tue Oct 11, 2016 4:09 pm

@badmoontaylor

There are only 2 frames, frame 1 is landed, frame 2 is jumping.

Sensitivity that's what it is. If you look in the infinite jumper demo- at the touch > gamma events. That sprite only has 1 frame. But if you mirror it on left and not mirror it on right you'll see what i mean.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Wed Oct 12, 2016 12:22 am

After looking at similar games, i think the problem may be with the platform speeds: speed, acceleration...

Have to mess around with it.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], Kin, ratboy3, tinhofiel, totoe, Yahoo [Bot] and 37 guests