How Do I set the visibility of duplicate sprite instances

Just started using Construct 2? Post your questions here

Post » Tue Sep 02, 2014 9:55 pm

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!

Directions:
L click & hold - drag
L click release - drop
R click over sprite - copy = true
L click & copy = true - paste
X - delete
C - change color
You do not have the required permissions to view the files attached to this post.
B
13
S
2
G
1
Posts: 47
Reputation: 1,211

Post » Wed Sep 03, 2014 7:17 pm

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?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163

Post » Wed Sep 03, 2014 11:04 pm

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?
B
13
S
2
G
1
Posts: 47
Reputation: 1,211

Post » Tue Sep 09, 2014 8:33 pm

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...
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests