Piggie needs to learn to play with others

0 favourites
  • 13 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi everybody.

    I've been trying to solve this problem for some time now. I haven't found anything similar in the forums.

    I want a certain Pig to find a path to another random Pig. What I did was:

    <img src="http://i.imgur.com/aVTAGXB.jpg" border="0">

    but what happens is he just targets himself. He's not interested in other pigs...

    How can I make him target other instances?

    Here's a simple capx recreating my problem.

    Thank you.

  • Pick random ?

  • I tried that on the capx I sent. You can see that the red ball goes to the randomly selected green square but the randomly selected square targets itself instead of another square.

  • in your example

    event 1

    add condition: Sprite2 is calculating pathinfinding. And in the even right click and invert it.

    <img src="https://dl.dropboxusercontent.com/u/7134196/horny.jpg" border="0" />

  • Sorry I sent the old file <img src="smileys/smiley24.gif" border="0" align="middle">

    Here it is.

  • Change it to the pic I posted, preview and wait.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank for your time lennaert on answering but it seems I'm not explaining properly.

    My actual problem is that I can't make an object find a path to a random instance of the same object.

    I gave the example of the Pig finding another Pig to play with. The problem is since I'm picking the Pigs "in the mood" to make them look for a path, I can't pick a different one for them to find a path (they don't have to be "in the mood", if Piggie wants, Piggie gets).

  • Getting back yo your first post, you are picking the "appropriate" pig, and then picking again from from that same set of one! Your subevent needs to first Pick all, then pick all pigs that do NOT have the "appropriate" condition, and then randomly pick one of those.

  • I've never used Pick All, didn't know what it did! I think I can understand how I can repick all of them but I don't know how the Actions would come in here. Tried a few things based on what you said but failed.

    Should it look kind of like this?

    <img src="http://i.imgur.com/3MiyuiC.png" border="0" />

    Could you help me with the actions now?

  • haha, thats what I thought at first, then saw your example ... and we got lost there somewhere, hehe

    here, hows this


  • Wow, nice one. Haven't thought of that one, obviously. Thank you lennaert.

    To be perfect I'll just have to come up with a way to not make the walking object target himself and to make it work in a way where more than 1 object can walk. I'm trying to make a virtual evolution game/simulation and I might happen to have +15 little piggies trying to find true love at the same time.

    Will work on this tomorrow as I'm too tired to do anything else. Thanks for all the help guys, much appreciated.

  • Add another local var targetuid

    when setting var x,y also set targetuid = Sprite.UID

    in second pick add Sprite.UID is not targetuid :)

  • Hey, just came here to report that it is kind of working the way I wanted. The help you gave me was great and enough for me to know where to go from now on. Thank you lennaert and blackhornet. You just made me and lots of piggies happy!

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