Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. io.stdout:setvbuf('no')
  2.  
  3. local L
  4. local H
  5.  
  6. local tableau = {}
  7. local brique = {}
  8.  
  9.  math.randomseed(love.timer.getTime())
  10.  
  11. function love.load ()
  12.  
  13.   L=love.graphics.getWidth()
  14.   H=love.graphics.getHeight()
  15.  
  16.  
  17.  
  18.   briqueL=L/16
  19.   briqueH=H/15
  20.  
  21.   for l=1,15 do
  22.     tableau[l]={}
  23.      for c=1,16 do
  24.       tableau[l][c] = 1
  25.      end
  26.   end
  27.  
  28. end
  29.  
  30. function love.update(dt)
  31.  
  32. end
  33.  
  34. function love.draw()
  35.  
  36.   local briqueX,briqueY = 0,0
  37.   for l=1,15 do
  38.     briqueX=0
  39.       for c=1,16 do
  40.        if tableau[l][c] == 1 then
  41.          
  42.   ----------------------------couleur random---------------
  43.          local r = math.random(1,255)
  44.          local g = math.random(1,255)
  45.          local b = math.random(1,255)
  46.          love.graphics.setColor(r,g,b)
  47.   -----------------------------------------------------------
  48.  
  49.          love.graphics.rectangle("fill",briqueX+1,briqueY+1,briqueL-2,briqueH-2)
  50.          
  51.        end
  52.       briqueX=briqueX+briqueL
  53.     end
  54.     briqueY=briqueY+briqueH
  55.   end
  56.    
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement