15 game
= true --false if a new map is generated TODO used?
17 MAXFPS
= 60 -- TODO used?
20 -- create map and physical world
21 Map
:generateMap() --TODO maybe use a real map instance to avoid global vars like map_grid
25 local tilesPath
= "gfx/tilebatch.png"
26 local realTileSize
= 32
27 local miniMapWidth
= 250
28 local miniMapHeight
= 150
29 local displayBuffer
= 1 -- We have to buffer one tile before and behind our viewpoint. TODO used?? kick..
31 maps
[1] = Map
:new({matrix
=map_grid
,noOfTiles
=noOfTiles
,tilesPath
=tilesPath
,realTileSize
=realTileSize
,displayBuffer
=displayBuffer
})
32 physics_createWalls(maps
[1])
34 local startcoords
= maps
[1]:generateSpawnPoints(100,100) --TODO map size in vars
35 entities
[1] = Ship
:new({})
36 entities
[1]:init(unpack(startcoords
))
37 entities
[1]:setSpeed(0) --TODO kick, and maybe kick setter to, not necessary
38 entities
[1].density
= entities
[1].body
:getY() --TODO kick
39 -- create sonar bubble that follows the ship
40 sonarbubbles
[1] = Sonarbubble
:new({size
=100})
41 sonarbubbles
[1]:followEntity(1)
42 -- Create main camera and mini map camera
43 cameras
[1] = Cam
:new({anchorX
=1,anchorY
=1,width
=love
.graphics
.getWidth(),height
=love
.graphics
.getHeight(),zoom
=1,map
=1})
44 cameras
[1]:followEntity(1)
45 cameras
[2] = Cam
:new({anchorX
=1,anchorY
=1,width
=miniMapWidth
,height
=miniMapHeight
,zoom
=10,map
=1})
46 cameras
[2]:followEntity(1)
47 -- cameras[2]:setPosition(1,1)
48 console
= Console
:new()
52 function love
.update(dt
)
54 for i
,c
in ipairs(cameras
) do
58 -- process_game_input()
62 -- iterate over cameras
63 for index
,cam
in ipairs(cameras
) do
70 function love
.keypressed(key
, unicode
)
71 if not console
:input(key
) then
74 if key
== "escape" then