5
--__ = require 'underscore'
6
vector = require 'vector'
16
signOf = function(value)
25
GameView = View:extend {
26
onNew = function (self)
29
-- self:add(Fill:new{x=x*400, y=y*400,
30
-- width = 32, height = 32,
37
image = 'data/stars3.png',
44
--the.player = CrystalPlayer:new{x=400,y=300}
45
the.player = SpacePlayer:new{x=1366,y=768}
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('the.player.x', 'the.player.x')
88
self.console:watch('the.player.y', 'the.player.y')
89
self.console:watch('the.app.width', 'the.app.width')
90
self.console:watch('the.app.height', 'the.app.height')
91
--self.console:watch('drawTook', 'the.drawTook')
94
onUpdate = function (self, dt)
95
if the.keys:justPressed('escape') then
99
update = function (self, dt)
100
the.updateStart = love.timer.getMicroTime()
102
if the.updateStart then
103
the.updateTook = love.timer.getMicroTime() - the.updateStart