Advertisement
xerpi

lalelilolu

Jul 22nd, 2011
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.18 KB | None | 0 0
  1. -- Por markef
  2. os.cpu(333)
  3. -- Carga modelo
  4. galeria = model.load("modelo/galeria.obj",0.001,black)
  5. -- Carga imagenes
  6.  
  7. imagen={}
  8.  
  9. for i = 1, 9 do
  10.     imagen[i] = image.load("tusimagenes/imagen"..i..".png")
  11. end
  12.  
  13. sombras = image.load("imagenes/sombras.png")
  14. fp1 = image.load("imagenes/fp1.png")
  15. fp2 = image.load("imagenes/fp2.png")
  16. fp3 = image.load("imagenes/fp3.png")
  17. fp4 = image.load("imagenes/fp4.png")
  18. --Luces
  19.     world.lighttype(1,2)
  20.     world.lightcomponent(1,1)
  21.     world.lightambient(1,color.new(255,255,255))
  22.     world.lightposition(2,0,0,-100)
  23.     world.lightenabled(1,true)
  24.     world.lightattenuation(1,0,0,0.0000005)
  25.     world.lights(true)
  26.     world.ambient(color.new(0,0,0))
  27.     world.specular(5)
  28.     world.update()
  29. -- Funcion splash
  30. function splash(im,te,vel)
  31.     local img = image.load(im)
  32.     local cont = timer.new()
  33.     te = te or 100
  34.     vel = vel or 1
  35.     for i = 0, 100, vel do
  36.         img:blend(0,0,i)
  37.         screen.flip()
  38.     end
  39.     cont:start()
  40.     while cont:time() < te do end  
  41.     for i = 200, 0, -vel do
  42.         img:blend(0,0,i)
  43.         screen.flip()
  44.     end
  45.     img:free()                 
  46. end
  47. -- Muestra splash
  48. splash("imagenes/splashmarkef.png",200,1)
  49. -- Colores
  50. white = color.new(255,255,255)
  51. black = color.new(0,0,0)
  52. red = color.new(255,0,0)
  53. -- Valores
  54. ejeY = 0
  55. ejeYi = 0
  56. i = 1
  57. triangle_pressed = false
  58. cross_pressed = false
  59. circle_pressed = false
  60. square_pressed = false
  61. --While
  62. while (true) do
  63. -- Modelo galeria
  64. galeria:position(0,ejeY,0.2)
  65. galeria:rotation(0,0,0)
  66. -- Lectura controles
  67. controls.read()
  68. -- Controles
  69. if controls.press("r") then
  70. tmp = screen.toimage()
  71. tmp :save ("ms0:/PSP/GAME/galeriamarkef/capturas/captura"..i..".png")
  72. i = i + 1
  73. end
  74. -- Fondo
  75. fp1:blit(0,0)
  76. -- Si pulsamos unos controles desplaza la galeria
  77. if controls.up() then ejeY = ejeY - 0.01 ejeYi = ejeYi - 2.5 end
  78. if controls.down() then ejeY = ejeY + 0.01 ejeYi = ejeYi + 2.5 end
  79. -- Pero si se pulsa otros se cambia el fondo
  80. if triangle_pressed then fp1:blit(0,0) end
  81. if controls.press("triangle") then triangle_pressed = not triangle_pressed end
  82. if cross_pressed then fp2:blit(0,0) end
  83. if controls.press("cross") then cross_pressed = not cross_pressed end
  84. if square_pressed then fp3:blit(0,0) end
  85. if controls.press("square") then square_pressed = not square_pressed end
  86. if circle_pressed then fp4:blit(0,0) end
  87. if controls.press("circle") then  circle_pressed = not circle_pressed end
  88. -- Muestra galeria
  89. galeria:blit()
  90. -- Reescala las imagenes de los lados
  91.  
  92. for i = 0, 6,3 do
  93.     imagen[i+1]:resize(80,89)
  94.     imagen[i+2]:resize(90,89)
  95.     imagen[i+3]:resize(80,89)
  96.     if i == 0 then
  97.         imagen[i+1]:blit(45.5,95 - ejeYi)
  98.         imagen[i+2]:blit(196,95.5 - ejeYi)
  99.         imagen[i+3]:blit(357.5,95 - ejeYi)
  100.     elseif i == 3 then
  101.         imagen[i+1]:blit(45.5,322 - ejeYi)
  102.         imagen[i+2]:blit(196,322.5 - ejeYi)
  103.         imagen[i+3]:blit(357.5,322 - ejeYi)
  104.     elseif i == 6 then
  105.         imagen[i+1]:blit(45.5,544 - ejeYi)
  106.         imagen[i+2]:blit(196,544.5 - ejeYi)
  107.         imagen[i+3]:blit(357.5,544 - ejeYi)
  108.     end
  109. end
  110.  
  111. --
  112. sombras:blit(0,0 - ejeYi)
  113. --
  114. sombras:blit(0,222 - ejeYi)
  115. --
  116. sombras:blit(0,450 - ejeYi)
  117. -- Print
  118. screen.print(175,30,"GALERÍA DE "..os.nick(),0.6,white,black)
  119. screen.print(147,40,"FECHA: "..os.date(),0.5,red,black)
  120. -- Muestra en el screen
  121. screen.flip()
  122. -- Finaliza
  123. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement