how would I get the name of an object inside a family?

0 favourites
  • 5 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I was searching around and I thought I had found some solutions to my issue or something but I just downright don't know or I'm doing something wrong. when the player collides with an object I want the game to call back to the object and then give me the name of the object.

    I have it so that the object is inside a family so when the player collides with any object in the family it will grab that specific object but it seems like there's no way for it to call to a specific object in family and get it's name or use it anywhere else. does anyone have a solution for it or something?

  • You shouldn't really need the name. Why ?

  • You have an expression family.ObjectTypeName

    I'm not sure if it is exposed to JS, but it probably is.

    So yeah, it is :)

    After picking use:

    weaponInInv[0].objectType.name

  • tysm man, I felt like I was going crazy, I didn't realize that I'd have to put objectType in there for name to work or anything. this was something I was looking at forever that I just was so confused on

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You shouldn't really need the name. Why ?

    well what I wanna do is take the object and create it over again but it seems with the way UID works it only works if there is already an existing instance. and also I wanted to make something where it could call to a function in js that would have the same name as the object for the shoot but at this point honestly I'm kinda just rethinking everything cus iit seems that might not work

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