@dave1707, there is one big block of code and you have helped me before (you will recognize it) which I really appreciate. I am now doubting myself and thinking the code must be a mess! (sorry for the formatting - I find it easier to read it this way without too much indentation - sacrilege I know - and obviously a couple of assets will be missing)
supportedOrientations( LANDSCAPE_ANY )
function setup()
displayMode(FULLSCREEN)
line1 = physics.body( EDGE,vec2(5,5),vec2(5,HEIGHT-5))
line2 = physics.body( EDGE,vec2(WIDTH-5,5),vec2(WIDTH-5,HEIGHT-5))
line3 = physics.body( EDGE,vec2(5,5),vec2(WIDTH-5,5))
line4 = physics.body( EDGE,vec2(2,HEIGHT-5),vec2(WIDTH-5,HEIGHT-5))
cDiam = 14
bodies = {}
for i = 1, 24 do
bodies[i] = physics.body( CIRCLE, cDiam)
bodies[i].gravityScale = 0.01
bodies[i].restitution = 1
bodies[i].position = vec2(math.random(WIDTH), math.random(HEIGHT))
bodies[i].linearVelocity = vec2(0,HEIGHT/2)
c1 = physics.body( CIRCLE,cDiam)
c1.x = math.random(WIDTH)
c1.y = math.random(HEIGHT)
c1.gravityScale = 0
c1.friction = 0
c1.linearVelocity = vec2(x1,y1)
func = info
end
end
function getLocalDateTime()
datetime = os.date("*t")
return datetime
end
function draw()
func()
end
function info()
datetime = getLocalDateTime()
second = datetime.sec
minute = datetime.min
hour = datetime.hour
year = datetime.year
month = datetime.month
day = datetime.day
wday = datetime.wday
r = hour*10.6
g = minute*4.25
b = second*4.25
background(r,g,b)
if (year == 2014 and month == 4 and day == 6) or
(year == 2014 and month == 5 and day == 14) or
(year == 2014 and month == 6 and day == 13) or
(year == 2014 and month == 7 and day == 12) or
(year == 2014 and month == 8 and day == 10) or
(year == 2014 and month == 9 and day == 9) or
(year == 2014 and month == 10 and day == 8) or
(year == 2014 and month == 11 and day == 6) or
(year == 2014 and month == 12 and day == 6)
then
noStroke()
fill(r,120)
ellipse(WIDTH/2,HEIGHT/2,HEIGHT-50)
end
letter = math.random(33,123)
bw = math.random(255)
if bw >= 125 then
bw = 255 else
bw = 0
end
fontSize(56)
w = WIDTH/2 - 200
eh = HEIGHT/2
t1 = " "
text(t1,w,eh)
w1, h1 = textSize(t1)
w2 = WIDTH/2
eh2 = HEIGHT/2
t1 = " "
text(t1,w,eh)
w1,h1=textSize(t1)
w3 = WIDTH/2 + 200
eh3 = HEIGHT/2
t1 = " "
text(t1,w,eh)
w1,h1=textSize(t1)
if (CurrentTouch.x <= 260 and CurrentTouch.y <= HEIGHT/2) then
font("GillSans-Light")
fill(255, 255, 255, 255)
stroke(255, 255, 255, 255)
end
if (CurrentTouch.x >= 260 and CurrentTouch.y <= HEIGHT/2) then
font("Futura-Medium")
fill(255, 255, 255, 255)
stroke(255, 255, 255, 255)
end
if (CurrentTouch.x >= WIDTH/2 and CurrentTouch.y <= HEIGHT/2) then
font("Baskerville")
fill(255, 255, 255, 255)
stroke(255, 255, 255, 255)
end
if (CurrentTouch.x >= 740 and CurrentTouch.y <= HEIGHT/2) then
font("BodoniSvtyTwoITCTT-Book")
fill(255, 255, 255, 255)
stroke(255, 255, 255, 255)
end
if (CurrentTouch.x <= 260 and CurrentTouch.y >= HEIGHT/2) then
font("GillSans-Light")
fill(0, 0, 0, 255)
stroke(0, 0, 0, 255)
end
if (CurrentTouch.x >= 260 and CurrentTouch.y >= HEIGHT/2) then
font("Futura-Medium")
fill(0, 0, 0, 255)
stroke(0, 0, 0, 255)
end
if (CurrentTouch.x >= WIDTH/2 and CurrentTouch.y >= HEIGHT/2) then
font("Baskerville")
fill(0, 0, 0, 255)
stroke(0, 0, 0, 255)
end
if (CurrentTouch.x >= 740 and CurrentTouch.y >= HEIGHT/2) then
font("BodoniSvtyTwoITCTT-Book")
fill(0, 0, 0, 255)
stroke(0, 0, 0, 255)
end
if wday == 1 then
wday = "Sun "
end
if wday == 2 then
wday = "Mon "
end
if wday == 3 then
wday = "Tue "
end
if wday == 4 then
wday = "Wed "
end
if wday == 5 then
wday = "Thu "
end
if wday == 6 then
wday = "Fri "
end
if wday == 7 then
wday = "Sat "
end
if month == 1 then
month = "Jan "
end
if month == 2 then
month = "Feb "
end
if month == 3 then
month = "Mar "
end
if month == 4 then
month = "Apr "
end
if month == 5 then
month = "May "
end
if month == 6 then
month = "Jun "
end
if month == 7 then
month = "Jul "
end
if month == 8 then
month = "Aug "
end
if month == 9 then
month = "Sep "
end
if month == 10 then
month = "Oct "
end
if month == 11 then
month = "Nov "
end
if month == 12 then
month = "Dec "
end
rf = math.floor(r)
gf = math.floor(g)
bf = math.floor(b)
u = HEIGHT/2+220
text(rf, WIDTH/2-200, u)
text(gf, WIDTH/2, u)
text(bf, WIDTH/2+200, u)
n = HEIGHT/2+120
text(hour, WIDTH/2-200, n)
text(minute, WIDTH/2, n)
text(second, WIDTH/2+200, n)
h = HEIGHT/2 -120
text(wday,WIDTH/2-200, h)
text(day,WIDTH/2 -85, h)
text(month,WIDTH/2+46, h)
text(year,WIDTH/2+196, h)
noFill()
strokeWidth(1)
ellipse(WIDTH/2-200, HEIGHT/2, hour*5.1)
ellipse(WIDTH/2, HEIGHT/2, minute*2)
ellipse(WIDTH/2+200, HEIGHT/2, second*2)
strokeWidth(2)
rect(WIDTH/2-200, HEIGHT/2-190, 400-second*6.66, 10)
rect(WIDTH/2-200, HEIGHT/2-215, 400-minute*6.66, 10)
rect(WIDTH/2-200, HEIGHT/2-240, 400-hour*16.66, 10)
sprite("Dropbox:vignette",WIDTH/2, HEIGHT/2)
end
function touched(t)
if t.state == BEGAN then
if func ~= info then
func = info
return
end
if func == info then
if (t.x>w-w1/2 and t.x<w+w1/2 and t.y>eh-h1/2 and t.y<eh+h1/2) then
func = infoScreen
end
if func == info then
if (t.x>w2-w1/2 and t.x<w2+w1/2 and t.y>eh2-h1/2 and t.y<eh2+h1/2) then
func = fontScreen
end
if func == info then
if (t.x>w3-w1/2 and t.x<w3+w1/2 and t.y>eh3-h1/2 and t.y<eh3+h1/2) then
func = ornaScreen
end
end
end
end
end
end
function infoScreen()
background(b,r,g)
sprite("Dropbox:infoFlow",WIDTH/2, HEIGHT/2)
sprite("Dropbox:vignette",WIDTH/2,HEIGHT/2)
fill(255,255,255)
font("GillSans-Light")
u2 = HEIGHT/2+220
text("R", WIDTH/2-200, u2)
text("G", WIDTH/2, u2)
text("B", WIDTH/2+200, u2)
n2 = HEIGHT/2+120
text("H", WIDTH/2-200, n2)
text("M", WIDTH/2, n2)
text("S", WIDTH/2+200, n2)
noFill()
strokeWidth(1)
stroke(255,255,255)
ellipse(WIDTH/2-200, HEIGHT/2, hour*5.1)
ellipse(WIDTH/2, HEIGHT/2, minute*2)
ellipse(WIDTH/2+200, HEIGHT/2, second*2)
strokeWidth(2)
rect(WIDTH/2-200, HEIGHT/2-190, 400-second*6.66, 10)
rect(WIDTH/2-200, HEIGHT/2-215, 400-minute*6.66, 10)
rect(WIDTH/2-200, HEIGHT/2-240, 400-hour*16.66, 10)
end
function fontScreen()
background(b,r,g)
sprite("Dropbox:fontScreen 300 dpi 2048",WIDTH/2,HEIGHT/2,1024,768)
sprite("Dropbox:vignette",WIDTH/2, HEIGHT/2)
end
function ornaScreen()
background(b,r,g)
sprite("Dropbox:vignette",WIDTH/2, HEIGHT/2)
font("BodoniOrnamentsITCTT")
fontSize(32)
fill(bw)
for k, v in ipairs (bodies) do
local char = string.char(letter)
text(char,v.x, v.y)
end
end