Twitchy Follower

Get help using Construct 2

Post » Sat Mar 09, 2013 4:12 pm

I'm a complete beginner and I'm probably overlooking something very simple here, but I'd be really grateful for some assistance.

I'm making a basic platformer in which the lead character is followed by an assistant. I've currently got the assistant to follow by having the system compare their x coordinates and set the action of the follower to left/right if he's too far away from the player or stop if he's within 20.

It works perfectly except that if you keep walking while he is following you, his sprite 'judders' very noticeably while he walks. I adjusted it so that the game only checked the relative positions every few seconds (thinking that maybe the problem was that it was constantly checking and restarting his walk cycle) but it made no difference. Where am I going wrong?

Thanks in advance for all help.
B
5
S
1
Posts: 52
Reputation: 640

Post » Sat Mar 09, 2013 4:26 pm

It would be hard to say without looking at the code.

When the player isn't moving you could record his xy in a variable, then when he moves compare the distance of his current xy to the stored xy and if its say 100 or more update the stored xy again, then always have the follower move to the stored xy position.

If the followers x is below the stored x then play right animation, if its more then play left animation.
B
37
S
19
G
18
Posts: 616
Reputation: 10,237

Post » Sat Mar 09, 2013 4:32 pm

Thanks for the quick reply! I'll try that.
B
5
S
1
Posts: 52
Reputation: 640

Post » Sat Mar 09, 2013 5:15 pm

Unfortunately, the problem is still there however I get him to move.

The juddering only occurs when the assistant is following the player at the same time as the screen is scrolling (it's set to follow the player). When the backdrop is stationary (at either end of the level) there is no problem.
B
5
S
1
Posts: 52
Reputation: 640

Post » Sat Mar 09, 2013 5:20 pm

I don't know if this is any use, i just made it.

example

I havent used platform behaviour before and i don't know what method you are using so maybe some thing like this.
B
37
S
19
G
18
Posts: 616
Reputation: 10,237

Post » Sat Mar 09, 2013 5:45 pm

Wow! Thanks very much for taking the time to do that. I'll try using that method straight away. Much appreciated.
B
5
S
1
Posts: 52
Reputation: 640


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests