Mouse Position - Diagonal Map
How can I get mouse position on Diagonal map???
I´m using this code:
FAdjX := X - FSurfaceX;
FAdjY := Y + FSurfaceY;
FMapX := FAdjX div TileWidth - FAdjY div TileHeight;
FMapY := FAdjY div TileHeight + FAdjX div TileWidth;
FOffsetX := FAdjX mod TileWidth;
FOffsetY := FAdjY mod TileHeight;
case FImgMouseMap.Canvas.Pixels[FOffsetX, FOffsetY] of
clRed:
begin
FMapY := FMapY - 1;
FMouseDirection := 'NORTHWEST';
end;
clYellow:
begin
FMapX := FMapX + 1;
FMouseDirection := 'NORTHEAST';
end;
clWhite:
begin
FMapY := FMapY + 1;
FMouseDirection := 'SOUTHEAST';
end;
clLime:
begin
FMapX := FMapX - 1;
FMouseDirection := 'SOUTHWEST';
end;
else
FMouseDirection := 'CENTER';
end;
FMapX := FMapX + (FSurfaceY div (TileHeight div 2));
FMapY := FMapY - (FSurfaceY div (TileHeight div 2));
Edited by - kenniston on 7/27/00 4:28:42 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement