Using music for drama

This tutorial will show you how to get dramatic music which dynamically changes depending on the action.

Fighting music

Add this code to your enemy. You can have different music for different enemies.

Make sure your enemy has a separate page for seeking and attacking. This is the default for an enemy wolf brain. In the Seek & Attack page add

WHEN [page entered] DO [global][numvar: enemy1 music][increment by][1]
WHEN [started to][is dead] DO [global][numvar: enemy1 music][decrement by][1]

Have a logic cube with this kode

WHEN [global][numvar: enemy1 music][greater than or equal to][1]
…WHEN DO [play sound][Music First Contact][everywhere][volume][100] // put your choice of music here

What this will do is when any enemies are attacking  or seeking the player out to attack, the fighting music will play. When they are all dead, or at least all the attacking enemies are dead, the music will stop. You can have different music for different enemies.

WHEN [global][numvar: enemy1 music][greater than or equal to][1]
…WHEN DO [play sound][Music First Contact][everywhere][volume][100]
WHEN [global][numvar: enemy2 music][greater than or equal to][1]
…WHEN DO [play sound][Music Night Of Fright][everywhere][volume][100]

If there is any chance in your game of two different enemies attacking at the same time you will need to add this kode.

WHEN [global][numvar: enemy1 music][greater than or equal to][1] DO
…WHEN [global][numvar: enemy2 music][greater than or equal to][1]  DO
…/…WHEN DO [play sound][Music First Contact][everywhere][volume][100]

This will then default to the enemy1 music choice. If all of enemy1 dies first, the music will revert to enemy2 music. I do not recommend using this method if you have lots of different mixed enemies as getting the nested statements for all eventualities gets a little messy.

If you want to turn off your music at any point just add this line of kode. Probably good idea not to have multiple music samples playing at the same time.

WHEN DO [global][numvar:enemy1 music][equals][0]

Dying music

It is nice to play some dramatic music when your character dies. Add this to your character

WHEN [started to][is dead] DO [boolvar: dying][equals][true]
WHEN [boolvar:dying] DO
…WHEN DO [play sound][Music Defeat Sting][everywhere][volume][100]

Use this with a respawning mechanic for best effects.

 

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: