5
--__ = require 'underscore'
13
signOf = function(value)
22
GameView = View:extend {
23
onNew = function (self)
26
self:add(Fill:new{x=x*400, y=y*400,
27
width = 32, height = 32,
33
--the.player = CrystalPlayer:new{x=400,y=300}
34
the.player = SpacePlayer:new{x=400,y=300}
37
self:add(Enemy:new{x=400, y=300})
39
self:add(Cursor:new())
41
love.mouse.setGrab(true)
42
love.mouse.setVisible(false)
44
--self:loadLayers('data/map.lua')
45
self.focus = the.player
46
--self:clampTo(self.map)
48
draw = function (self, x, y)
50
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
54
MenuScreen = View:extend {
55
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
56
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
57
onNew = function(self)
59
self.title:centerAround(400, 200)
61
onUpdate = function(self, elapsed)
62
if the.keys:allJustPressed() then
63
the.app.view = GameView:new()
69
onRun = function (self)
70
print('Version: ' .. VERSION)
71
self.view = GameView:new()
73
self.console:watch('VERSION', 'VERSION')
74
self.console:watch('updateTook', 'the.updateTook')
75
--self.console:watch('drawTook', 'the.drawTook')
78
onUpdate = function (self, dt)
79
if the.keys:justPressed('escape') then
83
update = function (self, dt)
84
the.updateStart = love.timer.getMicroTime()
86
if the.updateStart then
87
the.updateTook = love.timer.getMicroTime() - the.updateStart