Action if part of picture is visible

0 favourites
  • 5 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • Hi guys

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

    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.



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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. <img src="smileys/smiley1.gif" border="0" align="middle" />

    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. <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Wow that's so great <img src="smileys/smiley32.gif" border="0" align="middle" />

    Exactly what I was looking for, and a really clever solution I have to say <img src="smileys/smiley4.gif" border="0" align="middle" />

    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!

  • No problem man. Don't hesitate to ask if you need any more help! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • 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

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