How do I Create a certain object using UID?

  • So I`ve spend 3 hours already reading tuts and parts of the manual, and still can`t solve my problem

    I have 6 items on screen, all of them are in one Family1

    The idea is when player clicks once on one of them he choose the object he wants to create, and then he clicks again to place it wherever he wants to.

    The problem is that everytime event create random object of that family

    I`ve tried to use binding on creating object by UID, but i couldn`t figure out how it works

    i use "pick nearest uid to mouse.x mouse.y" but how can i create the object i need?

    The only solution I know - is to create separate events for every object type in family, but this is unefficient

    Could you help me?

    And another little thing how can I unite 4 and 5 events?

    Thanks a lot for any help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The 'pick nearest to' is not necessary as you already have the Family1 object picked from the 'On left button clicked' event.

    To combine events 4 and 5 use 'or'

    [attachment=0:2jtnzo2j][/attachment:2jtnzo2j]

    For your main question, you can use a third party plugin called 'nickname' and so create objects by name. You could also combine your sprites into one sprite and have different animation frames on that one object instead of different object types. That way you could 'create' the objects based on animation frame number.

  • Yeah, the plugin Nickname is incredibly useful. It let you pick/create sprites regarding their new "nickname" attibute, which can be the same on multiple sprites.

    The simplest example of what it can do is spawning a specific object(s) from a family, which is absolutely impossible (as far as I know) with the standard Construct 2.

  • codah thanks A LOT for sharing that pluging. Though it took some time to roughly understand how it works.

    Here is my solution, may be it would help someone

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