7
image = 'data/player.png',
8
onNew = function (self)
10
self.maxVelocity.y = 400
12
onStartFrame = function (self)
13
-- this is all in startframe so it happens before
14
-- physics calc at beginning of update
17
self.acceleration.y = 800
19
if the.keys:pressed('left') then
20
self.velocity.x = -200
21
elseif the.keys:pressed('right') then
25
if the.keys:justPressed('up') then
26
self.velocity.y = -400
29
onUpdate = function (self)
30
-- this is called after physics, so this makes sense here
31
the.view.map:subdisplace(self)
35
GameView = View:extend {
36
onNew = function (self)
37
self:loadLayers('data/map.lua')
38
self.focus = the.player
39
self:clampTo(self.map)
44
onRun = function (self)
45
self.view = GameView:new()
47
onUpdate = function (self, dt)
48
if the.keys:justPressed('escape') then
b'\\ No newline at end of file'