3
3
image = 'data/player.png',
4
4
maxVelocity = {x=velLimit,y=velLimit},
5
5
minVelocity = {x=-velLimit, y=-velLimit},
7
self.collider = PlayerCollider:new()
8
the.view:add(self.collider)
10
6
onStartFrame = function(self)
11
7
if the.keys:pressed('left') then
12
self.velocity.x = -200 * the.activeMaze.moveMod
13
9
elseif the.keys:pressed('right') then
14
self.velocity.x = 200 * the.activeMaze.moveMod
16
12
self.velocity.x = 0
19
15
if the.keys:pressed('up') then
20
self.velocity.y = -200 * the.activeMaze.moveMod
16
self.velocity.y = -200
21
17
elseif the.keys:pressed('down') then
22
self.velocity.y = 200 * the.activeMaze.moveMod
24
20
self.velocity.y = 0
27
onUpdate = function(self, dt)
28
self.collider.x = self.x + self.width / 2 * (1 - self.scale)
29
self.collider.y = self.y + self.height / 2 * (1 - self.scale)
33
PlayerCollider = Fill:extend{
35
onUpdate = function(self, dt)
36
self.visible = DEBUG and the.console.visible
38
23
onCollide = function(self, other)
41
24
other:displace(self)
42
p.x = self.x - p.width / 2 * (1 - p.scale)
43
p.y = self.y - p.height / 2 * (1 - p.scale)
b'\\ No newline at end of file'