Kha Shmup Tutorial Wrap Up
Finished Product
Wrap Up
We set out to learn how to make a basic game in Kha and step-by-step we put together a game using basic features of Kha. We learned the basics of rendering sprites, recieving input, playing sound, and we wrote a basic animation system as well as object pools for the types of objects we were going to be creating and destroying over and over.
Extending the Game
This game can be extended in a number of ways, here are some of the things that immediately come to mind:
- Provide levels for the player to get through - either by score-chasing or just playing through a specific sequence of enemies.
- Allow enemies to shoot back at the player.
- Add a cool scrolling background.
- Develop different kinds of enemies other than the basic one we have.
- Improve performance - there are a few points such as Gun.getActiveBullets() and EnemySpawner.getActiveEnemies() where we are generating a new array every frame - we could probably extend Hitbox to contain whether or not a given hitbox should generate collisions or not and remove this hit altogether. There are also a few points where we could cache values, short-circuit code, etc.
- Use a more robust collision system - for this game what we are doing works, but we may want to provide multiple collision callbacks, or even use something like QuadTrees.
- Design an AudioManager to handle sound, so if the user wants to adjust the volume or turn sound off, its easily adjustable in one place.
- Use or develop a more fully-featured ui system, so that if the screen size is adjusted, the ui is appropriately scaled and adjusted.
- Develop an EventSystem so that classes can register to recieve certain types of events, or to send events.
- Generally clean up the code base, maybe develop the game using a different architecture, such as an entity-component-system or model-view-controller.
Resources
Kha 3D tutorials by Lubos Lenco.
Lubos Lenco’s github contains a lot of great stuff, including the zui gui system for kha.
Another great Kha tutorial by James Hoffman.
hxScout for profiling your games.
bfxr.net for quick audio generation.
Probably a ton more I am forgetting - please include more in the comments!