Game Development Community

Bounds / Stupidity

by Jeremy Easoz · in Torque Game Builder · 06/19/2008 (9:04 pm) · 2 replies

I have a tile grid thats 10 tiles wide by 15 tiles tall.
I wrote a function to rotate 4 tiles in the grid.

Top Left Grid Tile = 0,0
Top Right Grid Tile = 9,0
Bottom Left Grid TIle = 0,14
Bottom Right Grid Tile = 9,14

Special Cases for Rotation.
Bottom Left Corner, 9,0
The Whole Bottom Row, <1 >9 and 14
Bottom Right Corner, 9,14
The Whole Right Column 9 <1 >14

if(%x == 9 && %y == 14) // Bottom Right Corner
{
// handle rotation
}

if(%x == 0 && %y == 14) // Bottom Left Corner
{
// handle rotation
}

if(%x >= 1 && %x <= 8 && %y == 14) // Bottom Row
{
// handle rotation
}

if(%x == 9 && %y >= 1 && %y <= 13) // Right Column
{
 // handle rotation
}

Everything other then those 4 cases is a normal rotation that wont rotate tiles outside the bounds.
What is it? :D

#1
06/20/2008 (8:36 am)
Making a tetris game? There is a tetris tutorial in the TDN that does this.
#2
06/20/2008 (12:58 pm)
No it's a different kind of game.

if((%x >= 0 && %x <= 8) && (%y >= 0 && %y <= 13)) // Everything that's not the Bottom Right Corner/Row
{                                                                                    // Top Corner /  Right Row
// handle rotation
}