Saturday, August 15, 2015

In Which Our Protagonist Needs to Explode

Today was a small day in terms of programming; once the spike from yesterday was created, I needed to take the step forward and populate the maze with these dangers, so I set the class in the Maze to spawn upon creation of a ground tile; in the case of a block, the block must be aware of other tiles around it to spawn a proper spike jutting out of the wall, so I might create an array that holds cell information as well as the array that holds StaticMeshActors. So far the spikes populate fairly well, with a function that covers a set percent of the ground with them.

Once the danger is released, the ball must interact with it. By using delegates from a previous project, I was able to take the OnComponentBeginOverlap event of the spike mesh and use AddDynamic to attach a delegate method for extra behavior upon collision. By separating the death behavior to the ball, the spike need only grab the first player pawn and call its public Die method, to which the ball is no longer visible and no longer simulates physics, spawning a convincing explosion (preset Starter Content explosion, but can be tailor-made in case) upon its disappearance to make it look dead without actually destroying the object. Boom.



What's next? Spawning the spikes out of the wall and finding out how to attach these objects to the root maze actor; it'll be difficult to keep track of them if they're all over the place during gameplay.

No comments:

Post a Comment