-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgridmain.lua
47 lines (40 loc) · 846 Bytes
/
gridmain.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
debug = true
require 'util/Util'
require 'crafting/VGrid'
require 'crafting/MultiGrid'
grids = nil
function love.load(arg)
grid = VGrid.new{twidth = 6, theight = 6, tileSize = 32};
grid:placeObject({
name = "Radioactive Poop",
imgname = "assets/Tiles/Ground_3.png",
img = nil,
-- Only intiated at placement
x = 0,
y = 0,
persistent = true,
twidth = 3,
theight = 2,
flatdata = {1, 1, 1,
1, 1, 1},
}, 4, 4)
grid.x = 300
grid.y = 300
grids = MultiGrid.new()
grids:addGrid(grid)
end
function love.draw()
--grid:draw(100, 100)
grids:draw(100, 100)
grids:drawHeldObj(love.mouse.getX(), love.mouse.getY())
end
function love.mousepressed(x, y, button)
if button == 1 then
grids:pickUp(x, y, 100, 100)
end
end
function love.mousereleased(x, y, button)
if button == 1 then
grids:drop(x, y, 100, 100)
end
end