Hi

@Ottawa: I just posted the function for the bottom of the player since I started to solve that problem first. When that was done, I use the same principle for the head of the player with some modifications.

@Ottawa: Yes, my bitmaps dimension is a power of two.

The function works fine now for player’s bottom and head. Still some glitch at the corner when players left side meet the red color. Need to solve that problem now smile

Here's my progress

Code:
function collisions_startup()
{
	wait (3); 
	
	var coords1_x, coords1_y, coords2_x, coords2_y, coords3_x, coords3_y, coords4_x, coords4_y;
	var format, pixel1, pixel2, pixel3, pixel4;
	COLOR pixel1_color, pixel2_color, pixel3_color, pixel4_color;
 
	while (1)
	{
		
		// check player's bottom
		// Problem solved
		coords1_x = 700;
		
		if (coords1_x <= (my_player.pos_x + bmap_width(player_tga))) 
		{
		coords1_x = my_player.pos_x + bmap_width(player_tga) - 40;
	   }
		if (coords1_x >= (my_player.pos_x + bmap_width(player_tga))) 
		{
		coords1_x = my_player.pos_x + bmap_width(player_tga);	
		}	
	 
		coords1_y = my_player.pos_y + 40;
		format = bmap_lock (level_tga, 0);
		pixel1 = pixel_for_bmap(level_tga, coords1_x, coords1_y);
		pixel_to_vec (pixel1_color, NULL, format, pixel1); 
		if (pixel1_color.red == 255) 
		{
			my_player.pos_y -= 2;
			}
			
			
	// check player's top
	// Problem solved
      coords2_x = 700;
		
		if (coords2_x <= (my_player.pos_x + bmap_width(player_tga))) 
		{
		coords2_x = my_player.pos_x + bmap_width(player_tga) - 40;
	   }
		if (coords2_x >= (my_player.pos_x + bmap_width(player_tga))) 
		{
		coords2_x = my_player.pos_x + bmap_width(player_tga);	
		}	
	
	   coords2_y = my_player.pos_y; 
		pixel2 = pixel_for_bmap(level_tga, coords2_x, coords2_y);
		pixel_to_vec (pixel2_color, NULL, format, pixel2); 
		if (pixel2_color.red == 255) 
		{
			my_player.pos_y += 2;
		}
		
		// Check players left side
		// Not solved, blocking fine, but still a glitch at the corners.
		// Player follow the edge around the corner when moving
		
		coords3_y = 450;
		
	   if (coords3_y <= (my_player.pos_y + bmap_width(player_tga))) 
		{
		coords3_y = my_player.pos_y + bmap_width(player_tga) - 40;
	   }
	   if (coords3_y >= (my_player.pos_y + bmap_width(player_tga))) 
		{
		coords3_y = my_player.pos_y + bmap_width(player_tga);
	   }
		
		coords3_x = my_player.pos_x + 2; // play with 2
		pixel3 = pixel_for_bmap(level_tga, coords3_x, coords3_y);
	   pixel_to_vec (pixel3_color, NULL, format, pixel3); 
		if (pixel3_color.red == 255) 
		{
			my_player.pos_x += 2;
		}
		
		// Check players left side
		// Not done yet
		
		
	
	
		bmap_unlock (level_tga);
		wait (1);
	}

}