Yes. For some reason Close doesn't end the Application execution when expected. Usually you use Application.Terminate instead.
Also if you take a look at TAsphyreDevice component you will notice that it has OnInitialize event. That event can be used for aditional initialization procedures. So you can move all the stuff needed for SpriteEngine initialization into that even procedure.
I was thinking of adding another variable in TMapLine record.
I was thinking of redesignign Map record entirely but haven't figured out how exactly yet.
Yes multidimensional arrays can be a bit puzeling. All you have to do is learn how to think out of the box to fully understand them.
This might help you a bit:
Records (TTileData) are sheets of paper.
Lines (TMapLine) are books containing this sheets of paper.
Layers are shelves on which you have all theese books.
Map(TMap) is a library with all theese shelves.
Unfortunately we would need to create specific sprites for each layer. Good news is that upper layers won't need to have full grid of sprites but would have sprites only on certain positions so final count of sprites wont be 320 * number of layers.
From what I see you manually calculate map position which needs to be updated on mouse click. That is good as you only need to add additional condition which determines which layer are you editing.
Anywhay I have decided to go and redesign map record so it will support multiple layers.
I plan on designing layers in a whay so that they can have varios sizes, both in lenght as in sprite sizes used in them (hopefully it would alow us to implement paralax scrolling).
I would redesign scrolling procedure so it would be compatible with new layer types.
I would need to design map file routine to support storing all this information in organized manner (maped file approach). Don't wory I will also write short documentation explaining how this works so you could do futher changes in the future.
I also plan on adding some other tweaks to your code.
For instacne you are currently calculating your mouse position inside AsphyreTimer1.Process event procedure while you could easily just use TPanels OnMouseMove event to do so.
And to determine if mouse is over panel you could simply use TPanels OnMouseEnter and OnMouseExit events to detect when mouse is moved over panel and when away from it. The best thing about theese events is that they also detect if mouse moves over some other window which is positioned above your Panel.
EDIT: OnMouseEnter and OnMouseExit events are unfortunately not present in Delphi 7.
Bookmarks