Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Juego
- blanco = color.new(255,255,255)
- fondo = image.load("fondo.png")
- punt={img=image.load("menu/puntero.png"),x=30,y=26,w=20,h=20}
- select={
- {x=25,y=73,w=20,h=20},
- {x=25,y=107,w=20,h=20},
- {x=25,y=150,w=20,h=20},
- {x=25,y=148,w=20,h=20}
- }
- select.img=img=image.load("menu/logo.png")
- brad={img=brad = image.load("actores/brad.png"),x=213,y=65,w=216,h=140}
- function colision(objeto1,objeto2)
- if objeto1.x+objeto1.w >= objeto2.x and
- objeto1.x <= objeto2.x +objeto2.w and
- objeto1.y + objeto1.h >= objeto1.y and
- objeto1.y <= objeto2.y + objeto2.h then
- return true
- else return false
- end
- end
- temporizador = timer.new()
- temporizador:start()
- while true do
- controls.read()
- fondo:blit(0,0)
- for i=1,#select do
- select.img:blit(select[i].x,select[i].y)
- if controls.press("cross") and colision(punt,select[i]) then
- if i==1 then
- os.message("Incorrecto")
- dofile("niveles/nivel2.lua")
- else os.message("Correcto")
- dofile("niveles/nivel2.lua")
- end
- end
- end
- punt.img:blit(punt.x,punt.y)
- brad.img:blit(brad.x,brad.y)
- screen.print(45,73,"Brad Pitt",1,blanco,0x0)
- screen.print(45,113,"Bruce Willis",1,blanco,0x0)
- screen.print(45,150,"Tom Cruise",1,blanco,0x0)
- screen.print(45,188,"Nicolas cage",1,blanco,0x0)
- screen.print(134,228,"Tiempo = " .. math.floor(temporizador:time() /1000),1,blanco,0x0)
- if temporizador:time() >= 15000 then
- temporizador:reset()
- temporizador:stop()
- os.message("Se te acabo el tiempo")
- dofile("script.lua")
- end
- if math.abs(controls.analogy())>20 then punt.y = punt.y + controls.analogy()/30 end
- if math.abs(controls.analogx())>20 then punt.x = punt.x + controls.analogx()/30 end
- screen.flip()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement