5
--__ = require 'underscore'
6
vector = require 'vector'
15
signOf = function(value)
24
GameView = View:extend {
25
onNew = function (self)
28
self:add(Fill:new{x=x*400, y=y*400,
29
width = 32, height = 32,
35
--the.player = CrystalPlayer:new{x=400,y=300}
36
the.player = SpacePlayer:new{x=400,y=300}
39
self:add(Enemy:new{x=400, y=300})
41
the.cursor = Cursor:new()
44
love.mouse.setGrab(true)
45
love.mouse.setVisible(false)
47
--self:loadLayers('data/map.lua')
48
self.focus = the.player
49
--self:clampTo(self.map)
51
draw = function (self, x, y)
53
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
57
MenuScreen = View:extend {
58
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
59
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
60
onNew = function(self)
62
self.title:centerAround(400, 200)
64
onUpdate = function(self, elapsed)
65
if the.keys:allJustPressed() then
66
the.app.view = GameView:new()
72
onRun = function (self)
73
print('Version: ' .. VERSION)
74
self.view = GameView:new()
76
self.console:watch('VERSION', 'VERSION')
77
self.console:watch('updateTook', 'the.updateTook')
78
--self.console:watch('drawTook', 'the.drawTook')
81
onUpdate = function (self, dt)
82
if the.keys:justPressed('escape') then
86
update = function (self, dt)
87
the.updateStart = love.timer.getMicroTime()
89
if the.updateStart then
90
the.updateTook = love.timer.getMicroTime() - the.updateStart