Highly Evolved Blocks

I spent some time this morning creating a couple of scripts to add some more complexity and difficulty to my levels. I’ve created a script that causes certain blocks to break when you stand on them and another which has blocks moving horizontally and vertically. This should add some flavour and spice to the mix of each level while the player is on their journey.

Floating Block Script

Floating Block Script

I added a boolean to my floating block script so that i could easily select whether i wanted the blocks moving horizontally or vertically. A boolean is a data type with only two possible values: true or false. I tell the script if the variable “horz” (short for horizontal) is true, move horizontally and if it is false, move vertically.





Breakable Block Script

Breakable Block Script

For the breakable block script i created a function which is called whenever the player touches the block. It moves the block left and right rapidly for a short period of time then disables the object, when the block is disabled it calls a new function which will respawn the block after another short period of time. The nice thing about these scripts is i can blend them together on the same block, so in theory i can have floating blocks that break when the player lands on them.








Here are the scripts being executed in the game engine:

Breakable Blocks in Action

Breakable Blocks in Action

Floating Blocks in Action

Floating Blocks in Action


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: