Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Trash Cans!

Trash Cans!

Stompy9999
Stompy's Gamedev Journal · · 1 min read
1,591 12
In order to draw the sprites in order, so the ones in front would overlap the ones in back, I implemented a routine that would sort all of the game objects by order of their y position. This was done by putting the sprites into a binary search tree, and doing an in-order traversal to draw them with the correct overlap. I added a trash can object to test it, so here is the game running with 20 trash cans:


Here it is running with 2000 trash cans:


That seems to work fine, so I'm going to move on to getting grabbing and throwing working. Once I do that, I can get some enemies in to fight. I sense there might be a demo in the near future, one with fighting and trash can throwing.

Discussion

Loading comments...