GameDev Diary: Leveling up Projectiles Mechanics and Adding More Assets

Andrew Lukes
5 min readSep 24, 2023

--

Creating new pixel art animations and releasing the first demo of my game

Hi! This time I have been focusing on adding new animations and providing the player with more visual information inside the game. Overall I am making quite a progress in finishing the game. I have finally managed to create a working .exe file and release it on itch.io so don`t forget to check it out at the end of the article.

Let's dive in!

Photo by Cookie the Pom on Unsplash

· General Improvements
Movement and Attack Points Divided
Improved Player Tenders
Knight Gets Movement For Kills
Canon Shells
· New Animations
Explosion Animation
Blast Animation
Health Change Animation
Bullet Flying Animation
Death Animation
· Bug Fixes
· Demo Version
· Last Diary Entry

I have decided that the logo of BattleForge will be this 3D hammer. I have added it to the Godot loading screen and when I find a proper way to do it, I will put it in the place of the default Godot icon in the file preview.

General Improvements

Movement and Attack Points Divided

I have done this because it is easier to track whether a unit can shoot after moving or not. Thanks to that I was able to create the knight mechanic mentioned below

Improved Player Tenders

Player tenders now show the current amount of units each player has and update it on any change to the living_units group of nodes. Also, they now contain the color of the team they belong to.

Knight Gets Movement For Kills

This is a method reimplemented from the old project. When a knight kills a unit it gets another movement point allowing it to escape the rest of the enemy army.

Canon Ball

Canon Shells

I have managed to re-implement this projectile type from my old pygame project. Thanks to Godot, it was easy to add a sprite and a rotation around its axis when flying. The special ability of this projectile is to pierce enemies, which allows them to inflict damage on many units at once. But watch out for friendly fire!

class_name CanonShell
extends Projectile
var rotation_speed = 10 # The speed of rotation in degrees per second.

## code for cannonball
func _on_area_entered(area):
if not super._on_area_entered(area):
return

var parent = area.get_parent()
if area != parent.get_node("CollisionArea"):
return

elif parent.has_node("HealthComponent"):
parent.get_node("HealthComponent").hit(1)
# queue_free()

func _process(delta):
super._process(delta)

# Rotate the cannonball.
rotation += rotation_speed * delta
func stop_movement():
super.stop_movement()
rotation_speed = 0

New Animations

Note: All of the animations mentioned below are freely available on Pixilart. Feel free to use them for your own needs.

Explosion Animation

When a bullet exits a scene, it leaves behind it an explosion. It doesn't have any area damage, rather its main purpose is to signify that the bullet is leaving the scene. It also stops the rotation and animation of the projectile.

Blast Animation

It is played when a ranged unit shoots a bullet. It faces the angle, at which the bullet was shot. I have some problems rendering it properly on the musketeer unit, but I am sure I will be able to fix that until the next diary entry.

Health Change Animation

The health component is releasing a signal to its parent, that it has changed its hp value. In the parent component, I am then running a tween that lightens its color rect when the health increases and darkens it on a decrease.


func _on_health_component_hp_changed(hp, prev_hp):
update_stats_bar()
if color and $ColorRect.is_inside_tree():
var tween = get_tree().create_tween()
if hp < prev_hp:
tween.tween_property($ColorRect, "modulate", Color(0,0,0), 0.2)
else:
tween.tween_property($ColorRect, "modulate", Color(1,1,1), 0.2)

tween.tween_property($ColorRect, "modulate", Color(color), 0.2)
if hp <= 0:
queue_free()

Bullet Flying Animation

I did not like that the bullet was just moving through the screen in a straight line, so I made it a bit more interesting by creating a small animation that leaves a trail of smoke behind it.

Death Animation

When a unit dies, a little death cross appears to signify its death.

Bug Fixes

  • The player now isn't able to buy more units, when he runs out of money
  • Fixed the font size of the last label in the unit information bar
  • Fixed the size of icons inside the buy bar
  • Bullets now face the enemy properly
  • Fixed some problems with unit selection

Demo Version

View the demo version of my project on itch.io here

Check out the last diary entry here

Check out the next diary entry here

--

--

Andrew Lukes

Introducing Andrew Lukes: a Prague web dev & language enthusiast who shares his ideas on Medium. You can visit andrewebdev.online to see some of my projects