How Do I set the visibility of duplicate sprite instances

0 favourites
  • 4 posts
From the Asset Store
A whole set you need to create a gorgeous winter 2d game
  • Hey guys,

    I'm working on a project inspired by tonycrew 's level creator in the "How do I" FAQ in order to become more familar with construct as a whole. It's going well so far however, I ran into an issue I was hoping someone could help me with.

    I have a pullout menu on the left side for the different tile types you can drag and drop onto the 32 x 32 grid I have. The problem is though, When you duplicate the tile on the menu and place it on screen THEN close the menu and copy the instance on screen and place it, the object is created, but isn't visible until you open the side menu again. While there are many bugs in this project I'll probably bother the forums about again this is the one i'd like to tackle right now. lol

    Project file is included.

    Thanks guys!


    L click & hold - drag

    L click release - drop

    R click over sprite - copy = true

    L click & copy = true - paste

    X - delete

    C - change color

  • A quick hack to solve it would be to create an instance variable on the family of objects you are using the editor to create. The variable would be a boolean IsPlaced (defualt is false). when you close a menu and hide the objects, check IsPlaced before setting their transparency. When you place an object set the flag to true. Does that make any sense?

  • Thanks for the response Ruskul! Could you please explain a little further or post an example?

    I understand using instance vars, but what do you mean by putting it on the family of objects? What I'd like to do is have one sprite named 'tile' and then like the 'fire' tile in the example, create more 'elements' on the menu to spawn whatever tile I click. From there, be able to copy the instances including the color. Or would I have to make individual sprite for every color(element) I want?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should create a family - then add all the tiles that can be placed in that family, that way way you can just program the family to do what you want and not have to repeat the events for each tile... Though I think you do have to create an individual sprite for every color you want...

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