07-01-2014, 09:29 PM
(This post was last modified: 07-01-2014, 09:30 PM by Lexou Duck.)
Quote:Nice Lexou and Sketchasaurus. Sorry this is a bit off topic but how did you handle coding the layering/depth correctly?
good question kiddo
what i did was i made the player and enemy classes have, more than just x and y coordinates of where they are on screen, a z coordinate, which represents altitude
the idea is that the game does all the calculations of walking and shit without taking z into account
and at the end right before your draw the sprite onscreen, you do y = y +z so that they're drawn at the height needed
also this way i can just do stuff with z to make him jump how i feel
for the shadow that stays on ground just don't incorporate z
and for the layering, what works is doing
if (player.y + player.z < enemy.y + enemy.z)
add(player);
add(_enemy);
if (player.y + player.z > enemy.y + enemy.z)
add(enemy);
add(player);
add means to add the sprite into the sprite drawer class thingy, here in the correct order
aaand here's some progress, did the hops on the knael character, and fully programmed the HUD
(its choppy because gifcam, dont worry the game runs better irl)