|
Tetris Clone Algorithim |
shangshu
Member #8,168
December 2006
|
Hi all, I'm not familiar with the function rotate_sprite(bmp, spr, x, y, itofix(64)). In the game the user needs to have the ability to rotate the sprites as many times as they want before it reaches the bottom. What is a good method of doing this? switch(state){ state 3: rotate_sprite(bmp, spr, x, y, itofix(270)); Any ideas or suggestion are greatly appreciated |
Audric
Member #907
January 2001
|
Seems good to me, for the displaying part. (type 'case 1', not 'state 1' of course) Hovever, you'll need something else to detect collisions: For collision testing, you can use for example an array of 4x4 booleans. edit: I don't know if that was the question, but pressing left or right would set |
raccoon
Member #7,478
July 2006
|
well, if you keep everything in an array, I think it would be useful not to draw the tetrominoes as sprites, but just draw the blocks as represented in the array |
Simon Parzer
Member #3,330
March 2003
|
Yeah, make a 4x4 block array and rotate it by swapping columns with rows (first column is first row of the "transformed" matrix). If you do that upside-down you rotate clockwise. ---- ---- -XX- ---- -X-- XXX- --X- ---X -X-- X--- --X- -XXX -XX- ---- ---- ----
|
Ricardo Santos
Member #6,609
November 2005
|
I'm also on a tetris clone and used Simon's approach but using 0 and 1 as it's easier to deal with. You must think in blocks not in complete tetris pieces. Good luck! |
kentl
Member #2,905
November 2002
|
I think Simon meant to use an array of integers as well. His ASCII drawing is just a visualization of how it will look when you draw the array to the screen. |
Thomas Harte
Member #33
April 2000
|
shangshu said: rotate_sprite(bmp, spr, x, y, itofix(270));
cough [My site] [Tetrominoes] |
|