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,
36
image = 'data/stars2.png',
44
--the.player = CrystalPlayer:new{x=400,y=300}
45
the.player = SpacePlayer:new{x=400,y=300}
48
self:add(Enemy:new{x=400, y=300})
50
the.cursor = Cursor:new()
53
love.mouse.setGrab(true)
54
love.mouse.setVisible(false)
56
--self:loadLayers('data/map.lua')
57
self.focus = the.player
58
--self:clampTo(self.map)
60
draw = function (self, x, y)
62
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
66
MenuScreen = View:extend {
67
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
68
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
69
onNew = function(self)
71
self.title:centerAround(400, 200)
73
onUpdate = function(self, elapsed)
74
if the.keys:allJustPressed() then
75
the.app.view = GameView:new()
81
onRun = function (self)
82
print('Version: ' .. VERSION)
83
self.view = GameView:new()
85
self.console:watch('VERSION', 'VERSION')
86
self.console:watch('updateTook', 'the.updateTook')
87
--self.console:watch('drawTook', 'the.drawTook')
90
onUpdate = function (self, dt)
91
if the.keys:justPressed('escape') then
95
update = function (self, dt)
96
the.updateStart = love.timer.getMicroTime()
98
if the.updateStart then
99
the.updateTook = love.timer.getMicroTime() - the.updateStart