Drag n Drop Image Replacement

Get help using Construct 2

Post » Fri Oct 11, 2013 3:25 pm

Hi,

I am trying to replace sprite(tile) with a drag and drop sprite, and make layer become visible. (see attached Cabx)Also, I added layout random (just 3 layouts inn project) I have tried different ways. Made a global variable/local (TileCount, and I can not get it to work. I think the condition is not working to make layer 3 (Complete) visible. Then again it might just be the way I coded it. So if anyone can help me or point me in the correct direction, I will be very grateful for any help.

Link to Cabx Example:Tile Replacemet Example

Thanks,
John
B
19
S
4
G
2
Posts: 37
Reputation: 2,494

Post » Fri Oct 11, 2013 3:47 pm

You are using instance variables, global variables and family variables.

You are changing the instance variable and then destroying the instance while you are checking if the family variable is 2.

You should either change the family variable in an action and check that or change the global variable and check that.

you could also destroy the replacemanttiles at start of layout and system compare two values replacementtile1.count = 1 and replacementtile2.count = 1.

It would be even easier if you made the replacemanttiles 2 frames of the same sprite.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Oct 11, 2013 5:05 pm

Hi LittleStain,

Thanks for the reply! I tried the suggestions, but I am still unable to get it to work correctly. Could you make the suggested changes and reload the file?

Thanks again,

John
B
19
S
4
G
2
Posts: 37
Reputation: 2,494

Post » Fri Oct 11, 2013 5:33 pm

You only have to change two lines

In the global sheet:
Instead of blanktile add 1 to tilecount ->
use system addto variable Tilecount 1

And in the level sheet:
instead of blanktiles tilecount = 2 ->
use system compare variable tilecount = 2

And it should work.LittleStain2013-10-11 17:33:58
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Oct 11, 2013 7:28 pm

Thanks again, I did get it working, but now I have another question.

Is there a way to reset the global variables when the page load. I tried both startofLayout ->Set variable(Name)=0 and reset global, and both seem to lock up the tiles.

I uploaded my working project on the web. The reason I need to reset them is because each page has different blanks and the pages are random. From the online version the complete layer is active because of the global variable therefore, when it recycles pages the layer becomes active. Is there another way to handle it because I think I might be going at it all the wrong way. I am still learning.

I also updated the linked cabx file from my first post to the new code within the online project.

Link to online Test Project

Thanks again for your help,

John
B
19
S
4
G
2
Posts: 37
Reputation: 2,494

Post » Fri Oct 11, 2013 8:45 pm

I got it working completely, and thanks again for your help!

John
B
19
S
4
G
2
Posts: 37
Reputation: 2,494


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 54 guests