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
self:add(Cursor:new())
43
love.mouse.setGrab(true)
44
love.mouse.setVisible(false)
46
--self:loadLayers('data/map.lua')
47
self.focus = the.player
48
--self:clampTo(self.map)
50
draw = function (self, x, y)
52
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
56
MenuScreen = View:extend {
57
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
58
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
59
onNew = function(self)
61
self.title:centerAround(400, 200)
63
onUpdate = function(self, elapsed)
64
if the.keys:allJustPressed() then
65
the.app.view = GameView:new()
71
onRun = function (self)
72
print('Version: ' .. VERSION)
73
self.view = GameView:new()
75
self.console:watch('VERSION', 'VERSION')
76
self.console:watch('updateTook', 'the.updateTook')
77
--self.console:watch('drawTook', 'the.drawTook')
80
onUpdate = function (self, dt)
81
if the.keys:justPressed('escape') then
85
update = function (self, dt)
86
the.updateStart = love.timer.getMicroTime()
88
if the.updateStart then
89
the.updateTook = love.timer.getMicroTime() - the.updateStart