I changed the rocks so that when you smash them, they don’t just immediately turn into “drops” that you can collect. Instead, they turn into randomly smaller rocks. And you can continue to smash them into smaller rocks until they’re small enough for you to pick up.
This didn’t seem like a big change as I was writing the code, but it turned out to be an important milestone — it’s the first time when I was testing the game that it started to feel fun. Something about the randomness of the pieces of rock flying out into space and chasing after them actually feels like a game.
Check out version 0.0.6.2 over on the releases page.
It’s really easy to add GUI controls in BabylonJS, like text blocks. I’ll use these for the basic heads-up display. I also fixed a really sneaky bug that allowed the player to blow up the same rock twice if two bullets hit it at exactly the same time.
Check out version 0.0.6.1 over on the releases page.
I added a collision check for the drops, which means you can now pick them up after destroying a rock. It’s feeling more and more like an actual game.
Check out version 0.0.6.0 over on the releases page.
I added very simple drops to the game today. Destroying a rock spawns a few smaller objects. They don’t do much right now, other than drift through space, but these will become the resources that you’ll use to build a better ship.
Continue reading “Drops”
Added some random spinning cubes to shoot at. Slightly less boring than the spheres. Number of hitpoints is proportional to the size.
Version 0.0.4.0 here.
Latest version here.
With collisions working, it was really easy to add a simple “hitpoints” system. When there is a collision, check the two things that collided. If one of them does damage and the other takes damage, then reduce its hitpoints. If the hitpoints reach zero, destroy it. No fancy explosions, yet, because that’s all for show and doesn’t affect gameplay! I’m sticking to that MVP mantra.
Version 0.0.3.0 here.
Latest version here.
I guess it’s a pretty small group of people who get excited about “spatial partitioning,” but I think it’s one of the most interesting pieces of code to write in a game. There are lots of ways to do it, and the best choice for your game depends on lots of different factors.
Continue reading “Spatial Partitioning”
Detecting when two things are touching each other in 3D space can be a surprisingly difficult task. BabylonJS has its own built-in collision detection system, but it’s pretty basic and generic. I decided to write my own because I want a little more control and Ladon has some pretty specific constraints on how things interact. Also, it’s kind of a fun thing to write.
Continue reading “Collisions”
Spent some time making the ship turn to face the direction of thrust. This is a slightly tricky math problem that I had already solved back when this was a C++ project. The thing that always gets me is the trigonometry and the way that the resulting angles need to be wrapped so that they don’t get bigger than 180° or smaller than -180°. This was a chance for me to really make use of the browser’s debug console.
Continue reading “Flying Around”