# Partial collision

I decided to update update some of my terrain sprites to a more pokemon look and I ran into a lil snag. I have a tile where its part of a regular floor tile but the upper 4 rows of oixels need to be solid where the rest of the tile is needs to be free to walk on. you can see it in the pic below.

any ideas?

I think I might have a solution. here is the standard collision function…

``````/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////collision/////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
bool checkcolision(void) // Transformed it into a function
{
for(uint16_t i=0; i < tft.numcolision + 1; i++)
{
if(tft.collideRectRect(player_x, player_y,16,16,tft.solid[i].x,tft.solid[i].y,16,16))
{
if(tft.solid[i].spritecol == bedtop)return true;``````

ok so it uses player x and player y, then the width vand height of the player. then its the tile x and y and width and height.

we know that the library reads bit maps left to right, top to bottom. It seems I could make a second collision function that handles partial collision. change the height and width in the function for the bitmaps to say 16 and 4. so only the top of the bitmap will be collidable

Ok so having two different collision checks going at the same time makes them cancel out each other

You could check for a general collision first. If the player collided with the specified tile you could check if he collided with the solid pixels.