How do I target a specific instance of an object to create?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello. Apologies for this basic question. I appreciate there are already a lot of posts about this. I feel like I've read them all twice and I'm afraid I still can't quite get my head around it!

    I have a holding layout with 3 different instances of a tilemap object. I'm trying to spawn this tilemap in my main level layout using those instances but I can't figure out how to target them inside the create event.

    I can do 'system - create object - tilemap' simply enough but how do I go one level deeper and select the specific instance that I want to create?

    I thought I might be able to do this with the UID's but I can't work out how or where to do so within the create event. I have also tried to add instance variables to each instance and target them that way but again, I can't figure out where in the event sequence I can state which variable I want.

    I suspect it might be a logic issue on my part. My expectation is that I should be able to create a specific instance of an object on my layout.... but I'm now wondering if I need to create the object type first then somehow switch its instance to the desired one?

    Any help understanding this concept would be greatly appreciated. Please let me know if my question needs clarity. As you can probably guess, I'm very much the rookie programmer!

    thanks in advance

  • Hi Sam,

    I apologize if I didn't understand your question properly, but maybe this will help.

    Set tile(0, 0) to tile tileName.UID = theUID

    Tilemap documentation

    Set tile

    Set the tile at a position in the tilemap by its tile ID. The tile that is set can also optionally be flipped or rotated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks DFORMS. That's not quite what I meant but I didn't know that was possible so thanks! Bonus knowledge. :)

    What I was wondering essentially is if it's possible to do the same thing but with an entire instance of a tilemap rather than a single tile?

    I'm actually starting to think I've mis-understood the concept of instances and objects though!

    I do have a workaround at the moment which is to clone my tilemap object and make the changes to it which makes it a unique object that i can create elsewhere.

    My question then becomes - Is this a sensible idea? If I have 2 tilemap objects that both use the same tileset does Construct automatically use the same tileset image for both objects or am I in danger of creating duplicates?

    Thanks!

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