Build a construction menu where objects get duplicated

Get help using Construct 2

Post » Thu Apr 02, 2015 8:21 am

I searched the forum for days now and tried everything so this seems to be tough (or I am more stupid than i thought):

Here is the link to the http://internet-agentur-bodensee.com/uploads/gardenapp.capx

My game has one of those menus where you can choose an item and place it on an isometric map. Technically I want the clicked object (that specific object from the FAMILY) to be duplicated. A seemingly simple task.

Due to security reasons (I know...) its not possible to create an object by name, okay.
But its also not possible to create an object by UID? Why? And how can I solve the problem? There are going to be more than 200 different objecsts to place and I dont want to put in a click handler for every single one individually...

I also tried the nickname plugin, but it does not solve the problem because you still have to pick one sprite to name but I have to pick the object from a FAMILY. Due to obscure reasons the "Create object [FAMILY]" action creates an instance from a RANDOM family member and not the clicked one as you would expect.

Any help is greatly appreciated! Thanks in advance!
B
4
Posts: 6
Reputation: 226

Post » Thu Apr 02, 2015 11:04 am

Why not add a variable to the family, ie "name"

Have the click handler handle the family, and have it check the name, then you just get a list of subevents for creating individual members.

onclicked
sub
family.name = car
action create car
sub
family.name = dog
action create dog
sub
family set position to touch.x touch.y
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu Apr 02, 2015 11:13 am

I dont want to stupidly set sub-events for the 200+ objects like...
if "dog" then create "dog"...
Thats exactly the problem...
B
4
Posts: 6
Reputation: 226

Post » Thu Apr 02, 2015 11:28 am

I fear that is what it will come down to.

You would only have to do it once though.

You could do it in another way, have all the image for the objects, in 1 object, and refer to the frame/animation.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu Apr 02, 2015 12:01 pm

yes, I thought about the frame solution, but then every item on the screen will have the 200 frames and I am not sure, if this will affect performance.
Thanks for your helping to think things out.

If anyone feels like writing a plugin to clone and create objects based on the clicked object: I'd be happy to pay for that.
B
4
Posts: 6
Reputation: 226

Post » Thu Apr 02, 2015 1:35 pm

montego wrote:yes, I thought about the frame solution, but then every item on the screen will have the 200 frames and I am not sure, if this will affect performance.
Thanks for your helping to think things out.

If anyone feels like writing a plugin to clone and create objects based on the clicked object: I'd be happy to pay for that.



It will not effect performance any different.

The image needed for the frames are only loaded once :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Wed Apr 08, 2015 2:06 pm

Thanks again for the hint.
I made some tests with the frames and it works quite nicely, especially as I can use a seperate animation set for each menu make things a lot easier.
I will get back to you if your information concerning the performance was wrong and the game blows up close to the finish ;)
B
4
Posts: 6
Reputation: 226


Return to How do I....?

Who is online

Users browsing this forum: amazingdream, Exabot [Bot], lordsas, mekonbekon, tarek2 and 55 guests