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

2018/6/12

Remove transparent parts of the hitbox

fabipfolix fabipfolix

2018/6/12

#
I got some images with transparent parts. Is it possible, to make the transparent parts no part of the hitbox?
danpost danpost

2018/6/12

#
fabipfolix wrote...
I got some images with transparent parts. Is it possible, to make the transparent parts no part of the hitbox?
There are several things you can do to minimize the hit box. (1) if you have extra complete rows or columns of pixels around the edges of the actual image, they can easily be removed (just ask how, if so); (2) you can use different collision methods, or a combination of methods to alter the hit box (ask for a visual of this, if desired); (3) you can place extra conditions along with colliion detection to limit what counts as a collision; (4) you can, worst case, use what some might call pixel-perfect colliion, which deals directly with the color of pixels of the images involved. Much more information about what you are trying to do and the details of the images would be needed to determine what the best course of action would be in your case.
fabipfolix fabipfolix

2018/6/12

#
My picture is a Basketball Hoop. I removed the part, where the ball should go through. Here's the picture: The Picture
danpost danpost

2018/6/12

#
fabipfolix wrote...
My picture is a Basketball Hoop. I removed the part, where the ball should go through. Here's the picture: << Link Omitted >>
Need more than just a visual (which should have an img tag, not a url tag). Need actual size of image; need to know what you constitute as being part of your wanted hit box on that image (using pixel coordinates; etc.
fabipfolix fabipfolix

2018/6/12

#
danpost wrote...
fabipfolix wrote...
My picture is a Basketball Hoop. I removed the part, where the ball should go through. Here's the picture: << Link Omitted >>
Need more than just a visual (which should have an img tag, not a url tag). Need actual size of image; need to know what you constitute as being part of your wanted hit box on that image (using pixel coordinates; etc.
the img tag doesn't work for me. The picture size is written on the website and everything that's not transparent should be part of the hitbox. Edit: Now it worked:
danpost danpost

2018/6/12

#
fabipfolix wrote...
the img tag doesn't work for me. The picture size is written on the website and everything that's not transparent should be part of the hitbox.
Create a class and add Rim objects to the left and right of the transparent area where the ball is supposed to pass and use them in conjunction with the backboard for collision detection. Make the image of the Rim object transparent squares, close in height to the rim of the backboard image.
fabipfolix fabipfolix

2018/6/12

#
danpost wrote...
Create a class and add Rim objects to the left and right of the transparent area where the ball is supposed to pass and use them in conjunction with the backboard for collision detection. Make the image of the Rim object transparent squares, close in height to the rim of the backboard image.
I just cutted the Hoop in 4 parts and used that
You need to login to post a reply.