Aloha! Thanks PirateFish and Retroopla
Boomerang enemyI wanted to add a new enemy this week, so here's a rundown of the flow I have gone through to design and implement it.
The game needs more threatening things to fill the levels with. So the idea for the enemy was:
- It's classed as a big enemy. Big enemies won't be damageable by small Leilani, in the same way that she can't break big blocks. I don't really have any big enemies in the game at the moment.
- Mostly spiky, you can only attack during a specific window. You can't just rush in.
- Dangerous projectile
- It's a robot
- You can't cause it to roll, you just destroy it.
- The behaviour of the enemy will be more complex than others I currently have. But since the aim is to simply destroy it, the long term interactions with the enemy are a little more limited (it's more of a challenge than a tool that Leilani can use to her advantage).
I decided to do a boomerang-throwing enemy that patrols a platform and throws a boomerang at Leilani when it sees her. Leilani gets the chance to attack after the enemy has thrown the boomerang, so to defeat the enemy you need to put yourself in danger first.
I started with a placeholder sprite. Quite often I do some nice artwork first, but I wanted to get a feel for how the enemy would play first. It only took an evening to get a first pass version of the enemy in (as the game progresses it's definitely getting quicker to add new features, which is good!). When Leilani gets close the enemy starts tracking her, trying to maintain a certain distance.
Next I was able to get the projectile's boomerang behaviour working. Notice that the boomerang starts on a high trajectory - this allows Leilani to roll or crouch underneath it, rather than having to jump over it. I'm considering having two possible paths for the boomerang, either high->low or low->high, and some sort of condition would determine how the enemy throws it. Not sure yet.
Since the projectile code was borrowed from some old exploding cannonball projectiles, it had the unintended effect in this gif of the projectile exploding and destroying the enemy. People on twitter liked this effect, but for me it doesn't fit because:
- The enemy is supposed to catch the projectile
- I like to follow "form fits function". Objects that can be conceivably thrown like a boomerang don't look like they should explode.
Today I fixed it so the enemy catches the boomerang correctly. I also fixed some other little things, such as the enemy not walking off ledges when tracking Leilani.
Finally I started experimenting with some final artwork for the sprite. The placeholder sprite wasn't quite big enough for a "big" enemy, so I've gone a bit larger.
The gorilla-style one doesn't really work, as he's relying so much on his arms to stand up that he can't really throw things. I quite like the koopa-esque one on the right, though it's a bit too high-detail for the style of the game I think. When I continue work on the sprites I will probably simplify it a little first.