function init() timer = 0 power = 0 end function draw(dt) local active = GetBool("level.laser") if active then timer = timer + dt power = power + math.random(-3, (2400-power)*0.1) else power = 0 timer = 0 end if power < 0 then power = 0 end if power > 2400 then power = 2400 end UiColor(0.7, 0.6, 0.3) UiTranslate(10, 10) UiRect(UiWidth()-20, UiHeight()-20) UiColor(0,0,0) UiTranslate(5, 5) UiRect(UiWidth()-30, UiHeight()-30) UiColor(0.7, 0.6, 0.3) UiTranslate(20, 50) UiFont("bold.ttf", 32) UiText(GetTranslatedStringByKey("UI_TEXT_HIGH_POWER"), true) UiText(GetTranslatedStringByKey("UI_TEXT_ALL_SYSTEMS"), true) UiText(GetTranslatedStringByKey("UI_TEXT_MAXIMUM_POWER"), true) UiTranslate(0, 20) UiText(GetTranslatedStringByKey("UI_TEXT_CURRENT_POWER")..power, true) if active and math.fmod(timer, 0.5) < 0.25 then UiText("loc@UI_TEXT_ACTIVE") end UiTranslate(0, 60) local w=730 local h=50 UiRect(w, h) UiTranslate(5, 5) UiColor(0,0,0) UiRect(w-10, h-10) UiTranslate(5, 5) UiColor(0.7, 0.6, 0.3) UiRect((w-20)*(power/2400), h-20) end