Yoshi's Island eggs

0 favourites
From the Asset Store
Elevate your game with the Floating Islands Platform Pack.
  • Hi, I got it working so that the eggs stay a certain time delay behind the player.

    https://dl.dropboxusercontent.com/u/5426011/examples20/yoshi_eggs_time.capx

    I changed a few things to get it to work. First in addition to x and y I also save the time. This is so I can find the saved position just before and after a certain time. If the first egg would is half a second behind the player then I would find the positions closest to time-0.5. After that I can then interpolate between the positions with lerp. The send thing I change from the original is add to the front of the array instead of the back so I could trim off the excess with a set size.

  • Perfect! Thanks man. I appreciate you describing the changes too.

  • R0J0hound - cool, it looks great :) Even though this isn't my problem, I can see myself using the solution somewhere down the track.

  • Hi guys, sorry to unbury the thread, but I am currently working on an old project of mine, which uses a similar functionality. I successfully implemented R0J0hound solution, but I am struggling with one detail:

    The programming was made for a group of eggs already caught by the player, but let's say that I caught one more egg. What would be a good way of programming it to join the the other eggs as the last in line?

    Cheers!

  • pcfernandesjr

    In that example just adding another egg works fine to add it to the end. If you want the eggs to be ordered in the way you collect them you could do something like this to assign a number to the eggs you collect:

    global index=0
    
    on player collided with egg
    egg is not collected
    for each egg
    --- egg: set collected to true
    --- egg: set num to index
    --- add 1 to index[/code:1pc1953s]
    
    Then change the "for each" in the example to
    
    egg is collected
    for each egg ordered by egg.num ascending
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound

    Yeah, I though about something like you suggested on the code field. But I just got stuck there.

    I will try edit my code. Hope it works fine.

    Cheers and thanks for the help!

  • Hi R0J0hound!

    I followed your suggestion, but there is one problem. The eggs are overlapping each other, instead of positioning one behind another. Maybe this is something about the variables involved on LERP, or maybe the 'set target_time' part?

    Just to clarify, here is my code (the hidden bit is the 'while' part, forgot to expand it):

    Cheers!

  • Hi, I got it working so that the eggs stay a certain time delay behind the player.

    https://dl.dropboxusercontent.com/u/542 ... _time.capx

    I changed a few things to get it to work. First in addition to x and y I also save the time. This is so I can find the saved position just before and after a certain time. If the first egg would is half a second behind the player then I would find the positions closest to time-0.5. After that I can then interpolate between the positions with lerp. The send thing I change from the original is add to the front of the array instead of the back so I could trim off the excess with a set size.

    Oh it just like replay system to me, a shadow copy. Excellent!

  • pcfernandesjr

    Doesn't the original example do that too? Like alextro said it just positions the eggs where the player was a certain time in the past, so if the player stops they will all stack on him.

    I don't have a solution to keeping the eggs from stacking. I've tried stopping time advancement when the player doesn't move, but then the eggs are just frozen in space.

    One idea could be to think of the eggs as a chain attached to the player. So maybe leveraging the pin behavior to link them together and drop them with gravity and bounce them a bit.

  • How made the player can look to the follower? I need add this in my game, and when the player look to front of follower, can press an button to see the follower state or do dialogs. Like Pokémon Yellow.

  • How press the button and start the rest i know, but i don't know how made the player can look to follower, and trigger actions if the player is in front of follower (looking him). Thanks in advance.

  • This is an example of what I want to achieve. If anyone can help, this will be usefull for other people.

  • pcfernandesjr

    Doesn't the original example do that too? Like alextro said it just positions the eggs where the player was a certain time in the past, so if the player stops they will all stack on him.

    I don't have a solution to keeping the eggs from stacking. I've tried stopping time advancement when the player doesn't move, but then the eggs are just frozen in space.

    One idea could be to think of the eggs as a chain attached to the player. So maybe leveraging the pin behavior to link them together and drop them with gravity and bounce them a bit.

    Hi R0J0hound!

    Yes, I expressed myself badly. The eggs indeed are supposed to overlap each other while they're idle. That is fine.

    What happened is that they were overlapped while in movement. But this was due some mistake I did.

    The issue now is that, for each egg that joins the line, the LERPing gets more and more screwed up. Here is the current code:

    If you want to take a look on the real thing running, I uploaded the demo on my dropbox:

    https://dl.dropboxusercontent.com/u/129 ... index.html

    Cheers!

    This is an example of what I want to achieve. If anyone can help, this will be usefull for other people.

    Hi , maybe you should do this:

    have a way to check this before starting the following part of the code:

    1-which direction your character is facing

    2-if the x position of your character is greater or smaller (depending if the player will start walking left, or right.) than the x position of the follower

    I think that should work, but as we can see I am not an specialist <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">

  • Sorry, I don't know what's amiss. Assuming my example is correct then yours should work if there is no typos.

  • I'll made a .capx with the features that are shown in the image above.

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