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

2016/4/28

Making Tetris; Need help with blocks

nathanathan nathanathan

2016/4/28

#
Hi everyone! So I am making a Tetris remake, and I am having some issues. I have it set up so that when the block touches the ground or another block, it will stop moving. Everything works, except the hit boxes are rectangular around the blocks, and there are some parts that are transparent, but Greenfoot doesn't recognize it that way. Are there any ways to make it so Greenfoot will ignore the transparent pixels in an image, so the Tetris blocks will touch each other correctly? Thanks in advance!
Super_Hippo Super_Hippo

2016/4/28

#
What I was doing in my Tetris game was to have four block objects form one moving piece.
nathanathan nathanathan

2016/4/29

#
That is a good idea, however I feel like there has to be some way to make it so Greenfoot won't recognize any transparent blocks. If push comes to shove, I will most likely end up changing the blocks in some way, but for now I am going to continue trying to figure out how to get this to work. Thank you for the response!
nathanathan nathanathan

2016/4/29

#
Did you have any other ideas?
Super_Hippo Super_Hippo

2016/4/30

#
The methods Greenfoot uses to check for intersecting of objects use the whole image of the actors no matter if there are transparent parts or not. You can write your own methods to do so and there is a pixel perfect collision scenario out there, but this can easily result in massive lag. If you want to have the whole tetromino to be one object, you need to change the object when a part of it got removed when a row was filled. I think this will be more difficult than separating the tetrominos into the four blocks and make them move and turn together properly.
nathanathan nathanathan

2016/5/2

#
Alright, sounds good. Thank you for you help! (I like the use of the word Tetrominos :] )
You need to login to post a reply.