Tuesday 17 September 2013

Advanced Health Bar and Login Counter

Advanced Health Bar
Today we learned how to create the illusion of a progressive health bar. This is done by linking health to sprites such as this.

Full health Sprite

As you can see the sprite looks some what like a health bar and is set to change to another spirte as the player takes damage. Such as this sprite.

2/3 health sprite

Each sprite costume is linked to the relative health level.

Health code in Scratch

This block of of commands dicktates that once the health variabale reaches a leave below 100 and above 89 it will change the costume to health 1, showen below.
2/3 health sprite

Login Counter
We learned how to add a cloud variable to our games. With the addition of these we are now able to able a login counter to our games. 

Counter code

These blocks alow a login counter and cloud login counter on the screen to increase by 1 when a player clicks it, and then it hides the option form the view of the player.

Then the logout option appears on the screen.

Logout sprite

When this option is clicked it decreases the login counters by 1, hides itself and makes the login opton reappear.

Coutner code

No comments:

Post a Comment