Yoshi's Island eggs

0 favourites
From the Asset Store
Green island themed set of tiles for your platformer game.
  • 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.)

  • 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 guess it would be Pin behavior with bar or chained option and Sine behaviour it would keep jumping eggs.

  • 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.

  • 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.

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

    <img src="https://dl.dropboxusercontent.com/u/89532891/Everything/Images/Final.png" border="0" />

    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 ...

  • Almost got it ^^ Will post a .capx when it's done.

  • 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 :)

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

    edit: nevermind :T Explained on page 2

  • 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.

  • Actually that .capx I just linked to might not be the best way to go about this - the array is endlessly growing in size.

    This is as far as I got : Eggs.capx

  • Nope, it keeps popping the array. They will get big, but never above X amount. I tried running about for ages with no issues. Yours is looking good though, I'm just not too good at long formulas ^^

    EDIT: The array cells are 100 for the lowest and 220 for the highest, never going above.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok now it's actually solved. Re-download the .capx in my last post if you want to check it out!

  • Glad I could help ^^

  • *sigh*

    The lower the timescale, the closer the eggs follow eachother. Not sure how to apply dt to this one. Any ideas?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)