Yoshi's Island eggs

Get help using Construct 2

Post » Thu Nov 21, 2013 10:17 pm

I'd like to have an NPC follow my player in the same fashion Yoshi's eggs do in Yoshi's Island. I haven't been able to find any examples or anything on this though. Does anyone have any idea how it can be done?

(There's a platformer demo that comes with GM:S that does this but I know very little GML so meh.)
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Nov 21, 2013 10:36 pm

You could recreate the effect partially with lerp, but the Yoshi's eggs also seem to have a sort of platform behaviour of themselves.

Maybe it would be better to store the player's positions in an array and have the "eggs" move through those positions a certain amount of time after the player. Would take a lot of x and y info, though..
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 » Thu Nov 21, 2013 10:40 pm

I guess it would be Pin behavior with bar or chained option and Sine behaviour it would keep jumping eggs.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Thu Nov 21, 2013 11:18 pm

Someone posted this capx a while ago (sorry I can't remember who).

Is this what you're after? I never played any Yoshi games.
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Thu Nov 21, 2013 11:28 pm

Hmm it's close but not exactly what I'm going for. Basically the eggs copy Yoshi's movements down to the pixel but with a small delay. The higher the egg ID, the longer the delay, creating a sort of trail.

Here's a clip of it

I prefer this because there's no complex pathfinding accounting for the player's various movement types, risk of the follower getting stuck, etc.

I've read about using an array like LittleStain mentioned but haven't tried it myself. I'll give it a shot.MadFactory2013-11-21 23:32:14
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Nov 21, 2013 11:34 pm

I think it's a loop , and each of the eggs lerp to the egg that have it's ID as Egg.ID - 1 ...



Basically , it's a loop that runs every tick , the lastX/Y is first set to the Player's Position , and then , it lerps to lastX/Y and sets the position to this instance's position , to then re-lerp to it until it moves every egg ...

It probably won't work , but yeh , I don't have much time to debug it ...Whiteclaws2013-11-21 23:37:50
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Thu Nov 21, 2013 11:54 pm

Almost got it ^^ Will post a .capx when it's done.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 12:12 am

Well I can think of one way that is very easy, but maybe performance could be an issue. You just create an array when the egg is made and link it to their UID.

Then every tick, push the player's X/Y, wait an amount of time (relevant to the egg's IID), then every tick set the egg to the array's first X/Y value and pop it. That should do exactly what you want, but maybe a few eggs going could cause issues.

Anyway looking forward to seeing what you come up with :)
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Fri Nov 22, 2013 12:49 am

Solved! This is basically the same as what's in the .capx here.

edit: nevermind :T Explained on page 2MadFactory2013-11-22 01:32:11
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 1:12 am

This is what I came up with. The start needs some fixing and play around with the timing, but it works just like Yoshi and is actually pretty light on performance.
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Next

Return to How do I....?

Who is online

Users browsing this forum: jatin1726, Resslx and 36 guests