This is a continuation of my previous tutorial, Super Spooky House Part 1: Darkness & Torchlight
Here we're adding the background ghosties and flickering torches you can see above.
Spoopy Ghosties
The ghosties are an adaption of the butterfly tutorial I made before. So you begin with an empty layout and add some little sprites either side of the layout. Rotate the sprites on the right side of the layout by 180. These are ghost spawners, so give them an appropriate name, then add a ghostie sprite and hide him off the layout.
Beyond the spawners, add another sprite, this is a ghost buster. This may all sound a little confusing, so here is my layout:
Add the bullet behaviour to the ghostie and then move to the event sheet.
Add the following event to spawn the ghosts and move the spawner ready for the next spawn:
Every random(2,10) seconds -> ghostie_spawner spawns ghostie
ghostie_spawner set y to random(0,350)
Then add this event to the ghostie when it spawns:
ghostie when created -> ghostie set opacity random(0,75)
ghostie set scale random(0.1,0.5)
ghostie set bullet speed random(10,50)
And then a sub-event to ensure that the ghosties from the other side are the right way up:
ghostie x>300 -> ghostie set flipped
Finally something to destroy the ghosties so that your game doesn't fill up with millions of ghosts
ghostie collides with ghost_buster -> destroy ghostie
It should all look like this:
When you press play, it'll look a bit like this: