I have just checked your code.
There is no easy way to say this but your code is a mess. That is why I won't simply just do some changes to your code in order to solve your problem as I would have to change lots of it and you probably wouldn't understand what I did and why.
So instead I will try to tell you which parts of your code are god and which are not god and should be changed.
1. It was quite clever of you to use TDrawGrid for Cell picking. I myself probably would have never used that but instead do my own math for that similar as in that example of mine I posted before.
2. Why do you have 128 Images in your ImageList? And most of all why do you have same images at multiple indexes? Don't tell me that you are trying to use that image list to store the position of different Spheres in the grid.
I only recomend your ImageList to contain only all posbile spheres available (+1, +2, +3, ...,+9, -1, -2, ...). Then you only need to define somewhere in your program which ImageList index is used for which sphere. Note image list index starts with 0 and not 1.
3. You should store spheres information in two dimensional array like so:
Code:
var SphereMap: Array [0..7, 0..15] of Integer;
4. Upond clicking on certain cell you could use the information from that same array to find out what to do like so:
Code:
case SphereMap[row, column] of
1: Sum := Sum + 1; // +1 Sphere
2: Sum := Sum + 2; // +2 Sphere
...
10: Sum := Sum - 1; // -1 Sphere
11: Sum := Sum - 2; // -2 Sphere
...
end;
5. In your code you say that you set the starting time to 15 seconds but you have your timer interval set to half a second. So the player actually doesent have 15 seconds as stated.
6. I advise you set the ProgressBar max value to the starting time. This way progressBar will start being full and not only partially full as it does now.
7. Infact using TProgressBar might not be the best idea. Why? On windows Vista and newer the ProgressBar will show that default Windows ProgressBar moving animation which might not be desirable. You can use TGauge instead. It's usage is quite similar to ProgressBar but its look is not afected by the operating system you are running your program on.
So these are my coments and suggestions on your project so far. I hope they will be helpfull.
And you can always ask for further advice if you need it.
Bookmarks