repl.it
Love2D

No description

fork
loading
Files
  • main.lua
  • nohup.out
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function love.load()


  function translateVertices(vertices, x, y)--will translate every x and y value
    local bufferVertices = {}
    for i,v in pairs(vertices) do
      if (i % 2 == 1) then
        --modift x
        bufferVertices[i] = vertices[i] + x
      end
      if (i % 2 == 0) then
        --modift x
        bufferVertices[i] = vertices[i] + y
      end
    end
    return bufferVertices
  end


  helicopter = {}
  helicopter.x = 0
  helicopter.y = 0

  helicopter.parts = {cockpit = {10, 10 , 70, 10 , 100, 30 , 100, 50 , 80, 80 , 20, 80 , 0, 60 , 0, 30},
   tail_boom = {100, 30 , 200, 40 , 200, 50 , 100, 50},
    tail = {200, 40 , 210, 15 , 220, 10 , 220, 50 , 200, 50}
    }

  function helicopter:draw()
    for i,v in pairs(translateVertices(self.parts, self.x, self.y)) do
      love.graphics.polygon('line', v)
    end
  end

end

function love.update()

end

function love.draw()
  love.graphics.setColor(1, 1, 1) 


  helicopter:draw()

end