Mouse Button Down on the transparent area

Game Editor comments and discussion.

Mouse Button Down on the transparent area

Postby saikspaik » Wed Jan 05, 2011 8:50 am

If you add an actor with a sprite with transparent areas, the Mouse Button Down will work only on the opaque areas.
How to make that - Mouse Button Down work all over the sprite?
saikspaik
 
Posts: 14
Joined: Wed Jan 05, 2011 8:17 am
Score: 1 Give a positive score

Re: Mouse Button Down on the transparent area

Postby schnellboot » Wed Jan 05, 2011 9:21 am

fill the gaps with filled regions and add them the same event on mouse button down
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Mouse Button Down on the transparent area

Postby saikspaik » Wed Jan 05, 2011 8:19 pm

But what if my actor is moves, move filled region with it? And if actors more than one?
I mean, maybe GM have some sort of option to use bounding box, or add a mask that can be clicked instead of actor sprite? It would be very helpful.
saikspaik
 
Posts: 14
Joined: Wed Jan 05, 2011 8:17 am
Score: 1 Give a positive score

Re: Mouse Button Down on the transparent area

Postby skydereign » Wed Jan 05, 2011 9:03 pm

The only problem with using a filled region, is if you animation changes to something smaller, the filled region will stay the same size as before. So, you would want to create with dimensions equal to the actor's biggest animation. You can however implement a smaller box, when given a bigger box, by using xmouse/ymouse to determine where the click happened, but the filled region will always have to be the larger size.

To make it follow the actor, just make the filled region's parent, the actor you want to click. If your actor will always be clickable, I would have it create the filled region on it's create actor event.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Mouse Button Down on the transparent area

Postby 157pl » Thu Jan 06, 2011 2:36 pm

show us the actor so we can tell you where to put the filled regions.
if its rectangular you can put it over the whole actor
User avatar
157pl
 
Posts: 109
Joined: Thu May 13, 2010 10:49 pm
Location: AZ
Score: 3 Give a positive score

Re: Mouse Button Down on the transparent area

Postby saikspaik » Thu Jan 06, 2011 7:01 pm

Here is my sprite
Image
Mouse Button Down will work only when I click on white pixels (in this case)

But I want that Mouse Button Down work when I click inside of bounding box (I pictured it for illustration)
Image
saikspaik
 
Posts: 14
Joined: Wed Jan 05, 2011 8:17 am
Score: 1 Give a positive score

Re: Mouse Button Down on the transparent area

Postby sonicfire » Thu Jan 06, 2011 7:38 pm

best is to use a transparent PNG, and then add your "clickable" area as a second layer with 99% transparency (all this in your fav. graphics program).
So you won´t see that area in the game but it is "clickable" - this is what i do all the time :-) Hope it helps!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Mouse Button Down on the transparent area

Postby saikspaik » Fri Jan 28, 2011 7:02 pm

Okay, I tried both methods for solving problems with a transparent area, and the sources of my work below.
Method with the Filled Region works well for one actor, but if actors two or more, some of the problems begin.
Method with 99% transparent PNG layer works well, and I think this is the best variant, at least for now.
But anyway, GE needs an option where you can choose how to detect mouse click on the actor (bounding box, or precise check).

Hope you understand my english. :)
FilledRegionTest.zip
Variant with Filled Region
(65.51 KiB) Downloaded 78 times

PngLayerTest.zip
Variant with 99% transparent png layer
(66.74 KiB) Downloaded 89 times
saikspaik
 
Posts: 14
Joined: Wed Jan 05, 2011 8:17 am
Score: 1 Give a positive score

Re: Mouse Button Down on the transparent area

Postby sonicfire » Sun Jan 30, 2011 9:27 pm

saikspaik wrote:Okay, I tried both methods for solving problems with a transparent area, and the sources of my work below.
Method with the Filled Region works well for one actor, but if actors two or more, some of the problems begin.
Method with 99% transparent PNG layer works well, and I think this is the best variant, at least for now.
But anyway, GE needs an option where you can choose how to detect mouse click on the actor (bounding box, or precise check).

Hope you understand my english. :)
FilledRegionTest.zip

PngLayerTest.zip


You can always use an activation region and set it so the size of your sprite and let this check for events/collisions! :) (just make it a parent of your actor).

The other thing is, if you have e.g. a PNG file with alpha (transparency) and if you want to have bounding box collision checking, i always create another layer in photoshop, then make it completle black and set alpha to 1%. this way you cannot really see it but it´s there and gets considered for collision checking.

i´m totally fine with GE´s pixelperfect collision system! i dont like the bounding box stuff :D (just my opinion).
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Mouse Button Down on the transparent area

Postby saikspaik » Sun Jan 30, 2011 11:51 pm

The other thing is, if you have e.g. a PNG file with alpha (transparency) and if you want to have bounding box collision checking, i always create another layer in photoshop, then make it completle black and set alpha to 1%. this way you cannot really see it but it´s there and gets considered for collision checking.


So far, this is the best way. And by the way, about the png with alpha you've said in this same topic, remember?:)
I just thanks to your advice solve my problem, so thank you:)

i´m totally fine with GE´s pixelperfect collision system! i dont like the bounding box stuff (just my opinion).

The bounding box does not necessarily use everybody at once. ;) But if such an option was, it would only get better.
saikspaik
 
Posts: 14
Joined: Wed Jan 05, 2011 8:17 am
Score: 1 Give a positive score

Re: Mouse Button Down on the transparent area

Postby sonicfire » Mon Jan 31, 2011 2:01 am

saikspaik wrote:So far, this is the best way. And by the way, about the png with alpha you've said in this same topic, remember?:)
I just thanks to your advice solve my problem, so thank you:)


Doh! :oops: I´m getting old... :lol:
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron