Multiple Insatnces and multiple spawners

Get help using Construct 2

Post » Sun Mar 24, 2013 4:10 am

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 :).

http://www.4shared.com/get/oL9vMLgM/Shark_Extinction.html
B
11
S
2
Posts: 57
Reputation: 1,442

Post » Sun Mar 24, 2013 4:57 am

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 :)nimos1002013-03-24 05:00:38
B
40
S
10
G
2
Posts: 1,150
Reputation: 6,499

Post » Sun Mar 24, 2013 6:54 am

Thank you a lot nimos100 :). Great advice, I had thought of something similar to that, but your way is a lot more efficient.
B
11
S
2
Posts: 57
Reputation: 1,442


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests