Multiple Insatnces and multiple spawners

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hi all,

    I am trying to create an app which is similar to the game feeding frenzy. However, after being using this programme for a week and not having an big issues, I have come across something which I have not been able to solve.

    My issue is that I want to have multiple instance of an object, and depending on where they are, they 'swim' around the defined area in custom movement.

    I have got it somewhat working by doing:

    Set Variable

    'Unique' to Nemo.IID

    And then I create a sub event (under no collision with the shark) if Unique is less than 4, set the custom movement to 50. All the nemos move, besides one. I have changed all their instance variables but still do not understand what I am doing wrong and how this issue can be solved.

    So my questions are:

    How can I set certain nemos to be placed and move in certain areas

    And how can I after they are destroyed to spawn at the correct spawner object?

    Any Help would greatly be appreciated.

    Also, people are free to use the nemos, blue tangs and the shark in their own games if they want :).

    4shared.com/get/oL9vMLgM/Shark_Extinction.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure if this helps or not.

    But personally i think its a good idea in the event "on start of layout" to destroy all objects that you are not using. Just to make sure that you dont have rogue objects screwing things up suddenly. So if you have a main layer where the game take place, simply pick all <objects> and destroy them. And then add what you need with the system -> create object afterwards, if you need objects to be on the screen at the beginning of the game. The one object that is not moving might be due to it being a "rogue" object.

    "How can I set certain nemos to be placed and move in certain areas"

    Not sure if it fits your design, but a way you could do it, is simply to add a tracing sprite of each area, and setup the collision points so it fits it.

    Then add an ID variable to the Nemo object, called "Area_ID". As you create you Nemo objects, you add the UID of the tracing sprite to "Area_ID".

    After that you can add an event, that if Nemo objects with Area_ID = <Tracing UID> is not overlapping Tracing sprite then change direction, or what they have to do.

    And how can I after they are destroyed to spawn at the correct spawner object?

    If the above works for you design, you can simply let the Tracing sprite spawn the Nemos, and since its already picked if it spawns the Nemos, you can very easily in the same event set the "Area_ID" of the nemos to that tracing sprite.

    Hope it helps or at least give you some ideas :)

  • Thank you a lot nimos100 :). Great advice, I had thought of something similar to that, but your way is a lot more efficient.

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