here: try this:
Code:
red = Color.new(255,0,0)
green = Color.new(0,255,0)
blue = Color.new(0,0,255)
white = Color.new(255,255,255)
duhx = 50
duhy = 50
duh = Image.load("duh.png")
counter = Timer.new()
while true do
screen:clear(blue)
pad = Controls.read()
screen:blit(duhx,duhy,duh)
if pad:up() then
duhy = duhy - 2
end
if pad:down() then
duhy = duhy + 2
end
if pad:right() then
duhx = duhx + 2
end
if pad:left() then
duhx = duhx - 2
end
currentTime = counter:time()
screen:print(10,10,"Counter Time: " .. currentTime, white)
if currentTime > 2500 and currentTime < 5000 then
screen:clear(red)
end
if currentTime > 5001 then
counter:reset()
counter:start()
end
screen.waitVblankStart()
screen.flip()
end
problems in your original code:
1.whenever you print OR blit something to the screen: it MUST be done inside a function, or a loop. you blitted "duh" in neither, so it appeared for only a bit, and then cleared.
2. at the end of your loop, you stated screen:clear(blue), and then printed the time. when you cleared, you ALSO cleared the picture, so it only showed you the time.
3. you did not give duhx and duhy a value. how is luaplayer supposed to know?
4. you did not end your loop.
5. there were more, but im too lazy right now.
bb! and good luck!
EDIT: @ EminentJonFrost, you DO NOT need spaces between your ='s, <'s, or >',s. although they do make your code easier to read.