do an object follows the player

Get help using Construct 2

Post » Thu Sep 13, 2012 4:07 am

Hi guys I'm making a platform game who the player is followed by its dog. How can I do that seems naturally? I don't want to do the animation in the same sprite to the dog falls down when it's out of the edge.

Thanks a lot and sorry if I have write at the wrong place. Beginner! =]
B
2
Posts: 8
Reputation: 591

Post » Thu Sep 13, 2012 5:04 am

That is very simple.
Create a dog with its own sprite, animation and ect. Give the dog platform behavior.
Then do this
1) Dog -> compare X -> Less or equal then Player X -> simulate control RIGHT

2) Dog -> compare X -> Greater or equal then Player X -> simulate control Left

So, now when the dog is located not at the same spot on X coordinate with the player, it will move until it gets him
B
21
S
4
G
1
Posts: 59
Reputation: 5,122

Post » Thu Sep 13, 2012 5:06 am

P.S. If there are going to be any obstacles on the dog`s way try this.

1) Dog on collision with "Sprite obstacle" -> Dog simulate control JUMP.

So the dog will jump over the solid obstacles.
B
21
S
4
G
1
Posts: 59
Reputation: 5,122

Post » Thu Sep 13, 2012 5:10 am

P.P.S.
Dont forget to add Set MIRRORED (for left) AND NOT MIRRORED (for rigth). So the dog will always turn its had to the player.
B
21
S
4
G
1
Posts: 59
Reputation: 5,122

Post » Thu Sep 13, 2012 1:13 pm

Perfect! I was really stuck in the dog's jump. Thanks a lot AlexeyMak. I'm trying right now.
B
2
Posts: 8
Reputation: 591

Post » Thu Sep 13, 2012 1:19 pm

Depending on how complex your obstacles are, that could get messed up in a hurry. It'll do for simple stuff though. The alternative would be developing full AI and pathfinding... which is pretty tough for a platformer. Trust me.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Thu Sep 13, 2012 2:17 pm

Also, if it's a really simple game, you can use the rope style of pin.
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,211
Reputation: 18,480

Post » Thu Sep 13, 2012 2:42 pm

quick and dirty way platformFollower.capx
Last edited by Yann on Sun Sep 14, 2014 8:53 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Sep 14, 2012 2:00 am

Guys, I've tried with "pin" and the result was very nice then I tried "simulate control" and the result was awesome!!!! The dog seems free and then it comes back to the player. I've tried the Yann link too, but seems his construc version is most new than mine, so I can't open his link. Thanks all for help and soon that I can I'm gonna post my game with scirra construct for you. It's getting very nice.
B
2
Posts: 8
Reputation: 591

Post » Fri Sep 14, 2012 4:00 pm

my version is the last stable release, you should pick it up (:
http://www.scirra.com/construct2/releases/r103.2
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Next

Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, theosciandra and 23 guests