How do make a sprite collide with an element in a video?

Get help using Construct 2

Post » Tue Oct 27, 2015 7:24 pm

Hi all, i'm trying to make a game that interacts with my webcam feed.
I have a UserMedia object, with a black and white filter applied to It.
and i want to make my character to collide with the black parts of the video.
so he should be able to walk over the white areas of the video feed, and not be able to enter the black ones.
Any idea how can this be done?
Many thanks in advance!
Image
B
3
Posts: 7
Reputation: 189

Post » Tue Oct 27, 2015 7:56 pm

Wow... something like this could be super epic...

Poking around at what I can come up with...
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 290
Reputation: 5,070

Post » Tue Oct 27, 2015 8:02 pm

Cool thanks! looking forward..
I currently got it working in processing... but its a pain to code the rest of the game engine
B
3
Posts: 7
Reputation: 189

Post » Tue Oct 27, 2015 8:46 pm

I couldn't replicate this...

Thoughts I had that might work (But still not tested)
Get a plugin made to make the make a object's bounding box change to the color that you pick... (or colors)
Somehow turn your screen capture into data that can be put into C2...

If you figure this out... please let me know how you did it :D
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 290
Reputation: 5,070

Post » Tue Oct 27, 2015 9:16 pm

ok will let you know if I succeed.
was thinking maybe storing the frames from the camera as png files (turning the white into an alpha channel).
then using those PNGs as a Sprite or something of that sort?
B
3
Posts: 7
Reputation: 189

Post » Tue Oct 27, 2015 9:17 pm

But even if you set it as a sprite... how do you change the collision area?
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 290
Reputation: 5,070

Post » Tue Oct 27, 2015 9:35 pm

I applied the Multiply filter to it, and now all the whites become transparent alpha channel.
the question is is there a way in Construct to get the pixel color in a specific X/Y on the stage or the sprite?
Image
B
3
Posts: 7
Reputation: 189

Post » Tue Oct 27, 2015 9:40 pm

That's what I was trying to find before... but couldn't find anything like that...
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 290
Reputation: 5,070

Post » Tue Oct 27, 2015 9:48 pm

I asked about the same thing a couple of days ago. You can do that by using the canvas plugin, by positioning your sprite into the canvas and then using the plugin's "paste object" function. If you want to capture the entire window then resize your canvas to the window's size.
You then use the expression alphaAt(x,y) to get the alpha value of a pixel.
B
13
S
5
G
1
Posts: 116
Reputation: 1,805

Post » Tue Oct 27, 2015 10:14 pm

Thanks immortalx, I'll give this a go!
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 290
Reputation: 5,070

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests