That sounds reasonable. My next problem would be when to resort the
list. As I'm not showing many sprites I guess I could sort the list
every frame but its not very efficient. I'd like to only sort the list
when required. Anyone any ideas or am I approaching this in the wrong
way ?
From:
xiaorang@... [mailto:
xiaorang@...]
the Y-coord plus the height of the sprite make the z-order.
----- Original Message -----
From: "Ian" <
ian.munro@... >
Subject: [DelphiGames] Help on 2d sprite z-order sorting I'm developing
a 2d game that requires the sprites to be z-order sorted but am not sure
how to go about doing this. Basically the sprites move around a
rectangular space at angles of 45 degrees. The sprite that the user
controls can move in the normal four directions and also diagonally. As
they overlap each other the sprites higher up the screen need to be
drawn first. Should I base the sort on the Y-axis or have a separate
variable ? I also don't want to sort the sprites every frame so how
should I be checking to know when to resort the list ? I have put
together a short video that shows the game running so you can see the
sprite movement. I don't expect there to be more than 6 moving sprites
on screen at anyone time.
http://uk.youtube.com/watch?v=tl9ls02onj0
This email is intended solely for the person to whom it is addressed and may
contain confidential or legally privileged information. If you are not the
intended recipient, be advised that you have received this email in error and
that any use, dissemination, forwarding, printing or copying of this email is
strictly prohibited. Please notify the author by replying to this email and
destroying all copies of the email and attachments. Access to this email by
anyone else is unauthorised.
Email may be susceptible to data corruption, interception, unauthorised
amendment, viruses and delays or the consequences thereof. Any views or opinions
presented are solely those of the author and do not necessarily represent those
of Grosvenor Technology Ltd.
Grosvenor Technology Ltd. (incorp. Newmark Technology Ltd.) is a company
registered in England with company number 2412554.
The Grosvenor Technology Ltd. Registered Office address is Millars Three,
Southmill Road, Bishop's Stortford, Herts, CM23