pcfernandesjr's Recent Forum Activity

  • Yeah, the eggs are going too smoothly, it's weird. I don't have any ideas on how to solve this matter. Is there any other thing that you noticed?

    Just saw your .capx, thanks for your time man. =)

    It works nice for a top-down view, as you suggested with your, but my game is a side scroller.

    Regardless, now I can see clearly how I could simplify the "following" code! Thanks a lot for the tip!

  • After burning my brain a little bit I finally got some good results with my code.

    To give you guys a context:

    The player must collect the "eggs" that are at the screen. When the player touches an egg, it starts following the player.

    Touching a second egg, it follows the first egg, the third follows the second, etc.

    But I feel that there is a way to do some refactoring to the "Follow Player" part, but I have no idea how to do it. So I'm here to ask you guys, what can I do to improve it?

    The code, so far:

    <img src="http://i10.photobucket.com/albums/a126/shinobi_br/my_code_zps4c48e0ea.jpg" border="0" />

    Here's the demo: dl.dropbox.com/u/12937330/follow_test/index.html

    Thanks in advance!

  • OK, I made some changes at the code, now using only two objects: One to be caught, then it is destroyed to be replaced by other who will follow the player.

    <img src="http://i10.photobucket.com/albums/a126/shinobi_br/my_code_zps4981de7c.jpg" border="0" />

    It is working well. But there's still a problem. the second egg caught doesn't follow behind the first egg, but follows the player, hiding itself behind the first egg.

    I'd like to know if there's a way to create events that affects a specific instance, since every change I want to make at the variables affects the object, not an specific instance.

    Thanks for the help!

  • Event 5. You check if eggsSaved=1, only then should the first egg follow the player. This is probably not what you want.

    Also, you are not doing this very efficiently. Everything you have done could be done with one object with a few instance variables. that way you won't have to repeat code. 99% of the time if you are repeating code there is a better way.

    Let me know if it doesn't work for you.

    I thought that I had to check it in order to make the first egg properly follow the player. I would never guess it was that.

    I know it's not the best way to do this. Before this I tried to create the catching system only using one egg object, but I couldn't figure how to treat each object instance separately, so I made this way in order to produce some result before I go crazy :P. If you have any suggestions on how to do this I'd really like to learn!

    Thank you very much for your help!!

  • Hi everyone! Sorry to bother, but I need help!

    Well, my intention is to develop a game where your character must collect eggs scattered at the stage and take them to a checkpoint. When you pick up one egg (by touching it), it follows you. Get another one and it will also follow you, right after the last egg you caught, making a line.

    The problem is: After getting the second egg, the first one stops following you properly, staying fixed at one point, instead of going to the correct Player fixed point (It looks like the lerp formula is being ignored somehow).

    I don't know what to do to fix it. Could you guys give me a hand?

    This is my code so far:

    <img src="http://i10.photobucket.com/albums/a126/shinobi_br/my_code_zps5f866edf.jpg" border="0" />

    And a link to play the demo:

    dl.dropbox.com/u/12937330/follow_test/index.html

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is really fantastic. Congratulations for your work!

  • What does "dt" mean in Lerp?

  • Thanks guys, I will take a look at that thread and the game example!

  • Hi guys, I'm new at the Scirra community. Pleased to meet you!

    I want to make a sprite follow the player.

    When the player's sprite touches the other sprite, the latter starts following it's movements.

    I tried to do the following:

    Created an instance variable boolean called "caught"

    And then:

    <img src="http://i10.photobucket.com/albums/a126/shinobi_br/followfail.jpg" border="0" />

    But it doesn't work. the "ovo" sprite starts walking without the player sprite touching it. ;/

    I'd like to ask for your help.

    Thanks in advance!

pcfernandesjr's avatar

pcfernandesjr

Member since 12 Dec, 2012

None one is following pcfernandesjr yet!

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies