This site requires JavaScript, please enable it in your browser!
Greenfoot back
iansprograms
iansprograms wrote ...

2016/4/7

How to ignore transparency in Actor images.

iansprograms iansprograms

2016/4/7

#
I'm making an isometric game, and I want to click a mineral source to mine it. After mining the mineral source, it will be deleted. My code works great! However, the image has a transparent background so if I'm clicking the transparent parts, it will be deleted (this leads to much confusion). I want to know if it's possible to ignore transparency in the Actor Image while clicking the Actor. Here is my scenario -- http://www.greenfoot.org/scenarios/16377 Thanks in advanced!
danpost danpost

2016/4/7

#
Not only is some of the image transparent, but it has grass image that hides with the ground. You could do one of two things (that I could think of) to limit the action to the crystal image itself. One way is to add hitbox objects into the world that will check for the clicks; the other is to test the color at the location of the click on the crystal.
iansprograms iansprograms

2016/4/7

#
danpost wrote...
Not only is some of the image transparent, but it has grass image that hides with the ground. You could do one of two things (that I could think of) to limit the action to the crystal image itself. One way is to add hitbox objects into the world that will check for the clicks; the other is to test the color at the location of the click on the crystal.
The grass that's hiding with the background is fine, I meant it to be there. I will try the hitbox idea first, it seems easier than checking for the color. Thanks!
You need to login to post a reply.