Visual Timer Bar for Games

1

Attached Files

The following files have been attached to this tutorial:

.capx

game-with-timer-bar.capx

Download now 127.87 KB

Stats

2,760 visits, 4,668 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 3 Oct, 2013. Last updated 19 Feb, 2019

This is a very simple method for creating a visual timer bar for actions in the game. It greatly simplifies the method of creating timed events during games by making them visual.

In the image you see the Blue timer bar at the top. It starts there and every second it moves down 4 pixels. Along the left edge you see the timer triggers, these little squares trigger events when the timer bar collides with them. You can add more existing events by just holding down Control and dragging the triggers up or down the screen. Towards the top makes the events happen towards the beginning of the game and towards the bottom triggers them later on.

Here is the code that moves the timer bar down.

And here is the code that sets the collisions for different events.

I hope this is more self explanatory, I am sure there are many better ways of doing these, but I found the timers that are built into the game to be confusing, so for many of us that are more visually orientated this may be a better option. Anyway just set the timer bar and triggers to invisible and you are all set.

You could also place them on their own layers as well. I am attaching the capx file to here so you can look further at the code. I added a lot of comments to assist people with this as well.

Hopes this helps.

Demo game is on the Arcade at: scirra.com/arcade/example/8334/alien-attack

Allan

.CAPX

game-with-timer-bar.capx

Download now 127.87 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!