Eufloria > Eufloria Classic Mods

A Visible Game Timer

(1/1)

Breakord:
 :D
Want to know how much time have you been spending playing the level?
This may help!

(click to show/hide)
--- Code: ---function GameTimer() --Created by Breakord
local text = os.date("!%X",GetGameTime())--Add ! before %X,to format the time in Coordinated Universal Time, or the timer wont begin with 00:00:00
DrawSprite(5,GetScreenWidth()/2-90,19,0,0,0,0.99,15)
DrawSprite(5,GetScreenWidth()/2-90,19,1,1,1,0.99,13)
DrawLine(GetScreenWidth()/2-90,19,GetScreenWidth()/2-82,19,0,0,0,0.99,0,0,0,0.99,2)
DrawLine(GetScreenWidth()/2-90,19,GetScreenWidth()/2-90,7,0,0,0,0.99,0,0,0,0.99,1)--Draw icon(a clock)
DrawLine(GetScreenWidth()/2-76,19,GetScreenWidth()/2-66,19,0,0,0,0.99,0,0,0,0.99,1)
DrawBox(1,2,GetScreenWidth()/2-66,5,GetScreenWidth()/2+62,31,0,0,0,1)
DrawBox(1,2,GetScreenWidth()/2-64,7,GetScreenWidth()/2+60,29,1,1,1,1)
DrawText(GetScreenWidth()/2-60,24,text,0,0,0,0.99,10,10,1)
end
--- End code ---

Just add GameTimer() to function ScreenDraw() like this


--- Code: ---function ScreenDraw()
GameTimer()
end
--- End code ---

Aino's function DrawText() is called, so you have to add the codes below to the end of level files(.lua).

(click to show/hide)
--- Code: ---function DrawText(startx, starty, text, r, g, b, a, h, w, boldness)
--And here is a long function, supporting drawing text!
x = startx
y = starty
for i = 1, string.len(text) do
letter = string.sub(text, i, i)
if letter == 'A' or letter == 'a' then
DrawLine(x, y,x+(w/2),y-h, r,b,g,a,r,b,g,a,boldness)
DrawLine(x+w, y,x+(w/2),y-h, r,b,g,a,r,b,g,a,boldness)
DrawLine(x+(w/4), y-(h/2),(x+w)-(w/4),y-(h/2), r,b,g,a,r,b,g,a,boldness)
elseif letter == 'B' or letter == 'b' then
DrawLine(x, y, x+w, y-(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h+(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/8), x+w, y-(h/2)+(h/8), r,b,g,a,r,b,g,a,boldness)
DrawLine(x+w, y-h+(h/8), x+w, y-(h/2)-(h/8), r,b,g,a,r,b,g,a,boldness)
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y-(h/2)+(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y-(h/2)-(h/8), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'C' or letter == 'c' then
DrawLine(x, y-(h/8), x, y-h+(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/8), x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h+(h/8), x+w, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'D' or letter == 'd' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w-(w/4), y-(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w-(w/4), y-h+(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h+(h/4), x+w, y-(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w-(w/4), y-(h/8), x+w, y-(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w-(w/4), y-h+(h/8), x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'E' or letter == 'e' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'F' or letter == 'f' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'G' or letter == 'g' then
DrawLine(x+(w/2), y-h, x+w, y-(h/2)-(h/8), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-(h/2), x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-(h/2), x+(w/2), y-(h/2)+(h/6), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'H' or letter == 'h' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'I' or letter == 'i' then
DrawLine(x+(w/2), y, x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2)-(w/8), y, x+(w/2)+(w/8), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2)-(w/8), y-h, x+(w/2)+(w/8), y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'J' or letter == 'j' then
DrawLine(x+(w/1.5), y, x+(w/1.5), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5)-(w/2), y, x+(w/1.5), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5)-(w/2), y, x+(w/1.5)-(w/2), y-(h/8), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'K' or letter == 'k' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'L' or letter == 'l' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-(h/16), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'M' or letter == 'm' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'N' or letter == 'n' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'O' or letter == 'o' then
DrawLine(x+(w/2), y-h, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-h, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'P' or letter == 'p' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'Q' or letter == 'q' then
DrawLine(x+(w/2), y-h, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-h, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2)+(w/4), y-(h/4), x+w, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'R' or letter == 'r' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+w, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'S' or letter == 's' then
DrawLine(x, y-(h/4), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/4), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h+(h/4), x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h+(h/4), x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/4), x, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'T' or letter == 't' then
DrawLine(x+(w/2), y, x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'U' or letter == 'u' then
DrawLine(x, y-(h/4), x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/4), x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/4), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/4), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'V' or letter == 'v' then
DrawLine(x, y-h, x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'W' or letter == 'w' then
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'X' or letter == 'x' then
DrawLine(x, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == 'Y' or letter == 'y' then
DrawLine(x, y-h, x+(w/2), y-(h/1.5), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x+(w/2), y-(h/1.5), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x+(w/2), y-(h/1.5), r,b,g,a, r,b,g,a,boldness)
elseif letter == 'Z' or letter == 'z' then
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == '1' then
DrawLine(x+(w/2), y, x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2)-(w/8), y, x+(w/2)+(w/8), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-h, x+(w/2)-(w/4), y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
elseif letter == '2' then
DrawLine(x, y-h+(h/4), x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h+(h/4), x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == '3' then
DrawLine(x+(w/1.5), y, x+w, y-(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5), y-(h/2), x+w, y-(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5), y-(h/2), x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5), y-h, x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+(w/1.5), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+(w/1.5), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/1.5), y-(h/2), x+(w/2.5), y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == '4' then
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/2), x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == '5' then
DrawLine(x, y-(h/2), x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-(h/2), x+(w/2), y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-(h/2), x+w, y-(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/4), x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
elseif letter == '6' then
DrawLine(x+w, y-h, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/2), x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == '7' then
DrawLine(x, y-h, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == '8' then
DrawLine(x+w, y-h, x+w, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y-h, x, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/2), x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == '9' then
DrawLine(x+(w/2), y-h, x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-h, x, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-(h/2), x+w, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y-(h/2), x, y-h+(h/4), r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h+(h/4), x+w, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == '0' then
DrawLine(x+w, y, x, y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h, x, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y, x+w, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x, y, x, y-h, r,b,g,a, r,b,g,a,boldness)
elseif letter == '+' then
DrawLine(x+(w/2), y, x+(w/2), y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-(h/2), x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == '-' then
DrawLine(x+w, y-(h/2), x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == '^' then
DrawLine(x+w, y-h, x+(w/2), y, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+(w/2), y, x, y-(h/2), r,b,g,a, r,b,g,a,boldness)
elseif letter == '/' then
DrawLine(x+w, y-h, x, y, r,b,g,a, r,b,g,a,boldness)
elseif letter == ":" then
DrawSprite(1,x+(w/2),y,r,g,b,a,boldness*3)
DrawSprite(1,x+(w/2),y-h,r,g,b,a,boldness*3)
elseif letter == "." then
DrawSprite(1,x,y,r,g,b,a,boldness*3)
elseif letter == "?" then
DrawSprite(1,x+w/2,y-h/8,r,g,b,a,boldness*3)
DrawLine(x+w/2, y-h/6, x+w/2, y-h/2, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w/2, y-h/2, x+w, y-h/2-h/4, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w, y-h/2-h/4, x+w/2, y-h, r,b,g,a, r,b,g,a,boldness)
DrawLine(x+w/2, y-h, x, y-h/2-h/4, r,b,g,a, r,b,g,a,boldness)
end
x = x + w + 5
end
end
--- End code ---

Thanks for Aino's hard working~ :D

effect drawing:

Bonobo:
Very cool! Even if I currently don’t have the time to play Eufloria and therefore don’t need to check how much time I’ve been play procrastinating :•)

Aino:
Awesome! It's very cool to see more and more people adding new stuff that people haven't added yet that is actually kind of essential in some ways :P
This could actually open up a lot of possibilities for planning strategies if some map maker makes a map with a lot of timed spawns (this function would be a MUST then).

I got some ideas for you though:
- Add all the codes into two levels, one which is a demo and another a raw code. You can find examples of this from both my function page and Annikk's page :)
- Add a GameTime timer and a RealTime timer, this is mostly for Eufloria HD where you can speed up time. When you speed up the time the GameTime increases significantly faster than what the RealTime does. You don't need both timers visible at all time, you can make the RealTime timer pop up when GameTime ~= RealTime.
- From what I can see in the code, the clock hands are static. You can move these around with the game time, which would for the most part be an aesthetic thing.

Navigation

[0] Message Index

Go to full version