time bars that shows depleting time
fmakawa
Member Posts: 565
Hi Folks, I cant seem to find a current response to this. How do I create a time that gradually disappears as time passes. Like 15 seconds or 30 seconds etc.
Comments
method 1: fades away as time passes
constraint attribute
self.color.alpha = 1 - (min(self.time,15)/15)
method 2: shrinks from 100 pixel width down to zero pixel width
constraint attribute
self.size.width = (1 - (min(self.time,15)/15)) * 100
This tutorial is a really easy way to display any kind of metered value as a bar. The tutorial references health, but of course it could be use to represent anything you like.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thanks guys!