Action if part of picture is visible

Get help using Construct 2

Post » Mon Feb 13, 2012 6:03 pm

Hi guys

I made a little program, where you can "clean" the foreground, to show the background - its self-explanatory i think

http://dl.dropbox.com/u/61284640/Minigame1.capx

Now what I want to do is executing an action if you cleaned up the part where the smylie is in background. I really don't know if its possible, and how to make something like this.

Thanks

Geru

B
20
S
2
G
2
Posts: 34
Reputation: 2,525

Post » Mon Feb 13, 2012 8:19 pm

I whipped up a small example to test a solution for you. It looks like it works, so hopefully it's what you're looking for.

http://db.tt/FmppZj3f

I placed a bunch of invisible squares around the smiley, each with a private variable called "Visible". When the TouchPoint object overlaps each square, its variable gets set to 1 -- meaning it's now visible -- and added to a global variable keeping track of how many can be seen. When it's over a certain number (right now it's set to 22, out of 24 squares total I think), you can say that the smiley itself is now almost completely uncovered.

Of course, the finer details are up for adjustment. You can change the number of invisible squares, or their placement, or how many need to be uncovered before you declare the smiley itself visible. Lemme know if I didn't explain it well enough. SullyTheStrange2012-02-13 20:19:29
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Mon Feb 13, 2012 10:23 pm

Wow that's so great

Exactly what I was looking for, and a really clever solution I have to say
It was well explained too, and I'm thinking about to create the smilie as a own object and initialise it at start with an array containing your "Detectors" to completely cover the smylie with them programatically.

So I can set it to a random position.
Think that might work, gonna try it now :D

Thank you so much dude!
B
20
S
2
G
2
Posts: 34
Reputation: 2,525

Post » Tue Feb 14, 2012 12:26 am

No problem man. Don't hesitate to ask if you need any more help!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Tue Feb 14, 2012 5:08 pm

Ok I extended my program so it generates those "Detectors" programatically :)

But heres the problem.. Everything works well until you "cleaned" up a bigger part of the screen.. On mobile device it's even lagging more :/

But thats in your version too, I think its because of to many created "TouchPoints"...

I just could resize it, that you find it faster, think that should work, but if anyone has another idea that would be great :D

Maybe there's a better way to do this...?
If not, it's not a huge deal at all, but it would be nice ;)

Thank you alot


Geru2012-02-14 17:20:45
B
20
S
2
G
2
Posts: 34
Reputation: 2,525


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests