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/stars3.png',
43
--the.player = CrystalPlayer:new{x=400,y=300}
44
the.player = SpacePlayer:new{x=1366,y=768}
47
self:add(Enemy:new{x=400, y=300})
49
the.cursor = Cursor:new()
52
love.mouse.setGrab(true)
53
love.mouse.setVisible(false)
55
--self:loadLayers('data/map.lua')
56
self.focus = the.player
57
--self:clampTo(self.map)
59
draw = function (self, x, y)
61
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
65
MenuScreen = View:extend {
66
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
67
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
68
onNew = function(self)
70
self.title:centerAround(400, 200)
72
onUpdate = function(self, elapsed)
73
if the.keys:allJustPressed() then
74
the.app.view = GameView:new()
80
onRun = function (self)
81
print('Version: ' .. VERSION)
82
self.view = GameView:new()
84
self.console:watch('VERSION', 'VERSION')
85
self.console:watch('updateTook', 'the.updateTook')
86
self.console:watch('the.player.x', 'the.player.x')
87
self.console:watch('the.player.y', 'the.player.y')
88
self.console:watch('the.app.width', 'the.app.width')
89
self.console:watch('the.app.height', 'the.app.height')
90
--self.console:watch('drawTook', 'the.drawTook')
93
onUpdate = function (self, dt)
94
if the.keys:justPressed('escape') then
98
update = function (self, dt)
99
the.updateStart = love.timer.getMicroTime()
101
if the.updateStart then
102
the.updateTook = love.timer.getMicroTime() - the.updateStart