Look out - it's a SHARK!

This week at The Code Zone, hackers are playing GameDev Club's latest game 'Shark Attack'.

Look out - it's a SHARK!
This week at The Code Zone, my hackers are playing GameDev Club's latest game 'Shark Attack'. In this action-packed game, the player has to guide Zonebot through shark infested waters and the further Zonebot swims, the more points the player gets. We've also coded in some special wooden platforms to give good-old Zonebot a much needed rest in between his swims and to help him stay away from those sharp teeth... because just one hit from those sharks is game over!
For our Guided Hack this week, our hackers implemented coins that spawned randomly throughout the stage which gave the player extra points upon touching them - turning this survival game into more of a strategy one with figuring out if the extra points were worth getting too close to the sharks!
The coins are generated through clone creation but this time the cloning code is actually within Zonebot's sprite rather than the coin's. Whenever Zonebot takes a step, there is a broadcast code which causes the stage (and all the enemies and items in it) to move down simultaneously. By adding the coin cloning code into that broadcast script, it means the coins can spawn seamlessly with the rest of the game as it moves - super cool!
My young coders wanted to make getting the coins a little less risky. To combat this, we coded in a lives system using variables and sensing code. This meant that if we had a few lives left, it was worth swimming over for the coin even if we were hit by sharks! In addition, we also created a power-up which would either slow down the sharks by adjusting its movement speed or would make Zonebot invincible for a few seconds. Anything to get those precious coins!
For a refresh on Power-Ups and Variables, be sure to check out your Coding Skills on your Dashboard as we have an array of short tutorials which you can work through, add to your backpack and use for future games!
Happy Coding!


Chat to our mentors