..............
..............
Last edited by ironquark; 13-03-2012 at 11:30 PM. Reason: ..........
I can't get it to crash at all, can you tell more detailed steps? Also, you are using generics which aren't supported in my old Delphi7 - so can't compile it
As for the pieces moving, you need a timer with small interval for it. There's hundred different ways, but this is 1:
- In the onMouseUp event set moving := true, and save vector := piece2.position - piece1.position, set delta: single to 0.
- In the onTimer, draw piece1 to piece1.position + vector*delta and piece2 to piece1.position + vector*(1-delta), then add delta by something like 0.05 per tick.
- When delta>=1, set pieces to final positions and stop animation.
press the right button of your mouse to put the blocks at the board:
Uploaded with ImageShack.us
and when you match pieces below the blocks it crashes...
I'm using Delphi 2010 instead Delphi 7
I've posted the code to see if somebody can help...
The "Crash" problem happens on the ApplyGravity function,
Swap(A, B);
Exit(True);
You have to do something to avoid it Swap pieces out of bounds, on some tests it tried to swap a piece on -1,4
Cezar Wagenheimer from Green Sauce Games
Programmer of Druids - Battle of Magic, Abra Academy, Abra Academy - Returning Cast, Rabbit Jump, Dreams of a Geisha and Heroes from the Past: Joan of Arc
Wagenheimer's Game Development Blog
Bookmarks