There is no built in solution to your collision problem. They all require some amount of coding. You'll have to manually reposition your sprites after the collision. You could always move your sprite back to a place where there had previously not been a collision.

to do this..

in domove
[pascal]
oldX := x;
oldY := y;

// Move the sprite using a simple force based system.
x:=x+forceX;
y:=y+forceY;

[/pascal]
in oncollision
[pascal]
x:=oldX;
y:=oldY;
//check the collision again
//if there's a collision move either above, to the left, to the right, or below the object.

[/pascal]


I've done collision tutorials for DelphiX which might be able to help you.
http://www.cerebral-bicycle.co.uk/li...?cat=24&subj=5
In particular
http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=35

What I would be tempted to do would be,

1. Store the last X and Y positions in DoMove
2. On collision, call a funciton which moves the sprite back along its original path by checking at specific points if it's still colliding.

The function would take the current X - OldX and current Y - OldY to get a movedX and movedY. Then using a recursive function

This is pseudo-code and has never been compiled.. in fact, it was typed into the browser.
[pascal]
function mysprite.fixcollide( originx, originy, movedx, movedy : double; itteration : integer )
var
newx, newy : double;
begin
newx := originx + movedx;
newy := originy + movedy;

movesprite(newx,newy);
if itteration<10 then
begin
if checkcollision() then
begin
fixcollide( originx, originy, movedx/2, movedy/2, itteration+1);
end
else
begin
fixcollide( newx, newy, movedx/2, movedy/2, itteration+1);
end;
end;
end;
[/pascal]

or.. you could give each sprite a collision distance and set your sprites position to this based on the angle your sprite was travelling in.

so you'd work out the angle you were travelling in by storing the oldX and oldY each doMove.


On collision you work out the angle using atan2

Then you move in the opposite direction, the distance of your sprite's collision distance and the colliding sprite's collision distance. This way is quicker, but not as accurate as the first method.

There are TONNES of ways of handling collision detection and resolution. They can be as complicated or simple as you want.


As for the overlay problem, I'm not entirely sure I'm clear on what you mean..

Do you mean an overlay like a window around the play area? or do you want to tint the screen a particular colour with an overlay?

For the first case, the bordered window, you draw a bitmap the size of the screen, make a pretty border and fill the center with a transparent colour. However, this technique is quite wasteful and you'll want to break your window up into smaller parts.. to prevent wasting time rendering a large area of transparent pixels.

DelphiX is not a complete game engine. In order to craft your game, you have to write a sizable amount of code.

Hope this helps.[/pascal]