How do I Building mechanics

0 favourites
  • 10 posts
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • Hello lovely community of game developers!

    I am finding for help, I have this:

    2 sprites:

    Tent roof

    Tent floor

    When i create the full building in specific layer, if i want to create a new other tent building, the previous one disapear. I can't use for each because an error appear.

    CHECK HERE:

    gyazo.com/c7683e89b40586df6faad5efa8418404

    Thanks youuu all for reading my question!!!!

    <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • I'm going to guess that the previous instance isn't disappearing, but after you make a new instance, both of them get set to the exact same spot.

    What is the purpose of the second event running every x seconds? This is what is causing all the instances of your tent objects to be set on the same spot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm going to guess that the previous instance isn't disappearing, but after you make a new instance, both of them get set to the exact same spot.

    What is the purpose of the second event running every x seconds? This is what is causing all the instances of your tent objects to be set on the same spot.

    Oh no! not that. The every x seconds is showing to the player where is going to place the tent.

  • On the every x seconds event, add this condition for each object: System - Pick Nth Instance. Object is your Tent Roof/Floor, and instance is Self.Count-1.

    It might actually just be Self.Count or just -1, Sorry I don't have C2 available at the moment to test, but basically you want it to pick only the last created instance to move for that event. If it doesn't work try the others.

  • I've run into a similar problem and might have a fix just for you.

    If I'm understanding correctly, you're spawning new instances and want to grab only the one spawned?

    Create a global variable (or with an array, store the "int(Object.UID)" to that, a suggestion if you've learned arrays yet), and right after the new object is created, set the global variable to:

    int(<ObjectName>.UID)

    i.e:

    int(Tent.UID)

    If you do this right after a new instance is spawned (such as when you tell C2 to spawn one), it will pick the UID of the newly spawned object.

    In your other events, set an extra condition along the others to pick the UID of the newly spawned object (the one being selected with the mouse? I'm trying to understand your event logic so mind my attempt to help somewhat here), except with that, set the picked UID's value to the global variable name.

    Here's a visual example of what I mean:

  • I've run into a similar problem and might have a fix just for you.

    If I'm understanding correctly, you're spawning new instances and want to grab only the one spawned?

    Create a global variable (or with an array, store the "int(Object.UID)" to that, a suggestion if you've learned arrays yet), and right after the new object is created, set the global variable to:

    int(<ObjectName>.UID)

    i.e:

    int(Tent.UID)

    If you do this right after a new instance is spawned (such as when you tell C2 to spawn one), it will pick the UID of the newly spawned object.

    In your other events, set an extra condition along the others to pick the UID of the newly spawned object (the one being selected with the mouse? I'm trying to understand your event logic so mind my attempt to help somewhat here), except with that, set the picked UID's value to the global variable name.

    Here's a visual example of what I mean:

    Thanks youu! I didnt tried it yet but i am sure that will works!

    Thanks, tomorrow i am going to do this!!

  • what do you mean with "pot"

  • I couldn't wait to try it and.... tatatatatatata ITSS WOOOORKKSS THANKS YOUUU !!!!!!!

  • You're welcome, I'm really glad to help and happy to see you find a solution! Oh, and where it says "Pick instance with UID pot", "pot" is just the global variable's name.

    I.e, if it were to say "Pick instance with UID tent", "tent" is the name of your global variable you're using.

  • You're welcome, I'm really glad to help and happy to see you find a solution! Oh, and where it says "Pick instance with UID pot", "pot" is just the global variable's name.

    I.e, if it were to say "Pick instance with UID tent", "tent" is the name of your global variable you're using.

    Result:

    gyazo.com/622b2073553839a88abc279cd95bd21d

    yeaah! I understood that pot early! THANKSS!!

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