level 4
鑫晴X鑫晴
楼主
在游戏中加入计时器的效果

事件如图:

2个变量
MaxTimer:最大时间
TImer:当前时间
判断变量
如果 Timer > 0 Timer -= 1 * dt
如果 Timer < 0 Timer = 0
什么是 dt
Delta-time in seconds,即帧数,代表游戏时间表执行每一步所耗的时间。
在一个 60FPS 的游戏中,dt 的值为1/60秒。
Set Text
zeropad(floor(Timer/60%60), 2) & ":" & zeropad(floor(Timer%60), 2)
这条指令中包含着几个方法
补零
zeropad(number, digits)
Pad number out to a certain number of digits by adding zeroes in front of the number, then returning the result as a string. For example, zeropad(45, 5) returns the string "00045".
向下取整,去除小数
floor(x)
Round down x e.g. floor(5.9) = 5
求时间分数
time/60%60
求时间秒数
time%60
2017年06月03日 20点06分
1

事件如图:
2个变量MaxTimer:最大时间
TImer:当前时间
判断变量
如果 Timer > 0 Timer -= 1 * dt
如果 Timer < 0 Timer = 0
什么是 dt
Delta-time in seconds,即帧数,代表游戏时间表执行每一步所耗的时间。
在一个 60FPS 的游戏中,dt 的值为1/60秒。
Set Text
zeropad(floor(Timer/60%60), 2) & ":" & zeropad(floor(Timer%60), 2)
这条指令中包含着几个方法
补零
zeropad(number, digits)
Pad number out to a certain number of digits by adding zeroes in front of the number, then returning the result as a string. For example, zeropad(45, 5) returns the string "00045".
向下取整,去除小数
floor(x)
Round down x e.g. floor(5.9) = 5
求时间分数
time/60%60
求时间秒数
time%60