4 - Bombs
maze that is closed and add bombs and triggers to blow walls open. The
idea is that when the player gets to the trigger, all bombs explode,
destroying everything in their neighborhood. This can be used to create
holes in walls and to destroy monsters.
need three new objects: a trigger, a
bomb, and an explosion.
is extremely simple. It just sits there and does nothing. To make sure
monsters move over it (rather than under it) we set its depth
to 10. Object instances are drawn in order of depth. The ones
with the highest depth are drawn first. So they will lie behind instances
with a smaller depth. By setting the depth of
the bomb to 10 the other objects, that have a default depth of 0, are
drawn on top of it.
is also rather simple. When it collides with the person it turns all
bombs into explosions. This can be achieved by using the action to change
an object in another object. At the top we indicate that it should apply
to all bombs.
explosion object to show
the animation. After the animation, it destroys itself. (You have to
be careful that the origin of the explosion is at the right place when
turning a bomb into it. Try 32 x 32 first) The object also must destroy
everything it touches. This requires a little bit of work. First of
all, we do not want the explosion to destroy itself so we move it temporarily
out of the way. Then we use actions to destroy all instances at positions
around the old position of explosion. Finally we place the explosion
back at the original place.
each wall indicate the type of wall under object and the position of
sure the triggers are not next to the bombs.
is important to carefully design the levels with the bombs and triggers,
so that they present interesting challenges. You mark will be based
in part on the layout of the level.