5
--__ = require 'underscore'
6
vector = require 'vector'
18
signOf = function(value)
27
GameView = View:extend {
28
onNew = function (self)
31
-- self:add(Fill:new{x=x*400, y=y*400,
32
-- width = 32, height = 32,
39
image = 'data/stars3.png',
46
--the.player = CrystalPlayer:new{x=400,y=300}
47
the.player = SpacePlayer:new{x=1366,y=768}
50
self:add(Enemy:new{x=400, y=300})
52
the.cursor = Cursor:new()
55
love.mouse.setGrab(true)
56
love.mouse.setVisible(false)
58
--self:loadLayers('data/map.lua')
59
self.focus = the.player
60
--self:clampTo(self.map)
62
draw = function (self, x, y)
64
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
68
MenuScreen = View:extend {
69
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
70
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
71
onNew = function(self)
73
self.title:centerAround(400, 200)
75
onUpdate = function(self, elapsed)
76
if the.keys:allJustPressed() then
77
the.app.view = GameView:new()
83
onRun = function (self)
84
print('Version: ' .. VERSION)
85
self.view = GameView:new()
87
self.console:watch('VERSION', 'VERSION')
88
self.console:watch('updateTook', 'the.updateTook')
89
self.console:watch('the.player.x', 'the.player.x')
90
self.console:watch('the.player.y', 'the.player.y')
91
self.console:watch('the.app.width', 'the.app.width')
92
self.console:watch('the.app.height', 'the.app.height')
93
--self.console:watch('drawTook', 'the.drawTook')
95
-- back off that dark overlay a bit
96
self.console.fill.fill[4] = 75
99
onUpdate = function (self, dt)
100
if the.keys:justPressed('escape') then
104
update = function (self, dt)
105
the.updateStart = love.timer.getMicroTime()
107
if the.updateStart then
108
the.updateTook = love.timer.getMicroTime() - the.updateStart