Build a construction menu where objects get duplicated

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • I dont want to stupidly set sub-events for the 200+ objects like...

    if "dog" then create "dog"...

    Thats exactly the problem...

  • 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.

  • 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.

  • 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

  • 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

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