Friday, November 20, 2015

c++ - How to rotate blocks in tetris



I have a gameboard grid which is 20 rows high and 10 columns wide with the origin (0,0) being in the top left hand corner. I have a tetrimino in play, which is composed of four blocks. I have the x,y location of each block relative to the top left hand corner origin. I also have the position of the pivot, the point around which I wish to rotate which is relative to the top left hand corner origin.


Each block has an integer position in a gameboard square and thus the pivot has a fractional position inbetween blocks e.g (10.5,10.5)


My question is: Which formula can I use to rotate each block around the pivot?


I have already looked at existing similar questions and answers but could not find an answer that I could get to work.


Help would be much appreciated.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...