Make cool down of icon

1

Attached Files

The following files have been attached to this tutorial:

.capx

cool-down-time.capx

Download now 172.75 KB

Stats

2,154 visits, 3,727 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 22 Aug, 2015. Last updated 19 Feb, 2019

You can download the CAPX on the left. I hope to help beginners.

You need a box , a black box and a blue box.

Each box width and height are 100.

Red is skill icon, black is the remaining part of the cool down, blue is the test button.

Black box set opacity to 70.

Double-click the black box - Set origin and image points - Right-click the origin - Quick assign - Bottom.

Let black box cover the red box.

Insert mouse.

Add a global varible and it's name is "Start". Initial value is 0, then add a even, if mouse on button clicked on blue box, then start for cool down.

Add a new global variable and it's name is "Surplus". Initial value is red box's width and height(100).

Add an even, subtract 10 from "Surplus" every second. if you want to set the cool down time to 10 seconds, so every second subtract 10, if you want to set the cool down time to 100 seconds, so every second subtract 1.

Add two new conditions for that even."Start = 1" so that the blue box is clicked will execute system." Because cool down time = 0 when no need to subtract value, so "Surplus≥0" prevent the cool down = 0 after still subtract value.

Add an even, only the subtract globa variable's value is no effect,so we set black box's height to "Surplus".

Here is what will happen after end of cool down time, so, black will be invisible and all the global variables will restitution after end of cool down time.

Well, you don't forget add "black set visible" for first even. Otherwise the icon will be a problem after cool down.

.CAPX

cool-down-time.capx

Download now 172.75 KB
  • 0 Comments

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