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

2014/8/28

Hit Detection in transparent images

jackyyang09 jackyyang09

2014/8/28

#
When I use the "this.isTouching" function, it will count transparent edges as part of the actor's hitbox making things regeister as "touching" when they visually aren't. How do I bypass this without having to edit my image?
danpost danpost

2014/8/29

#
What is wrong with editing the image? Without editing the image you will be required to do a pixel by pixel check for the intersecting parts of the images. This could be extensive and cause lag.
jackyyang09 jackyyang09

2014/8/29

#
Well there isn't exactly anything wrong with editing the image, it would just be nicer to have actors that weren't all squares or rectangles. If there's no other alternative to checking pixels then I guess I'll try to make do.
danpost danpost

2014/8/29

#
If there are edges of your images that are totally transparent (edging that can be removed without removing any of the actual image, you could load them into my Image Transparency Adder/Trimmer scenario and re-save them (all excess transparent edges are removed automatically -- just load and save). You can download the scenario, open in greenfoot and save it as an application for future use.
You need to login to post a reply.