[I'm just experimenting... tried 3 different methods for now, this one got my atention because it's a built-in thing]


So about the improved code (I've found this inside an example from Asphyre 2d , the SpriteEngineRPGMap one to be exact)

Every time I move my character I write the following values into it's property...

Attachment 579

Code:
Left := Round(X); 
Top := Round(Y); 
Right := Round(X + Image.Width);
Bottom := Round(Y + Image.Height);
When my character collides with the PlatForm Sprite I do this :

1. Get same coordinates from Sprite I've just hit

Code:
procedure TBlurp.DoCollision(Sprite:TSprite; var Done:boolean);
var
TileLeft, TileRight,
TileTop, TileBottom: Integer;
begin
if Sprite is TPlatform then
begin
TileLeft := Trunc(TPlatform(Sprite).X);
TileTop := Trunc(TPlatform(Sprite).Y);
TileRight := Trunc(TPlatform(Sprite).X) + TPlatform(Sprite).Image.Width;
TileBottom := Trunc(TPlatform(Sprite).Y) + TPlatform(Sprite).Image.Height;
// up
if (GetKeyState(VK_UP) < 0) then
begin
if (Self.Top+3 > TileBottom) and
(Self.Right > TileLeft) and
(Self.Left < TileRight) then
begin
Y := TileBottom;
end;
end;
Attachment 580

Now that I drew it down... checking the logic +1 or -1 depending on direction should also be enough... maybe I'll look into my rounding... maybe I don't need it...

And I think I also understand why it does it like this ... in this case if I'm touching a wall from left or right... but Not touching a wall from TOP... it won't place me right bellow an incorrect tile...

I'll try to clean the code a bit more...

Greetings
Rob