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)
6
10
onStartFrame = function(self)
7
11
if the.keys:pressed('left') then
12
self.velocity.x = -200 * the.activeMaze.moveMod
9
13
elseif the.keys:pressed('right') then
14
self.velocity.x = 200 * the.activeMaze.moveMod
12
16
self.velocity.x = 0
15
19
if the.keys:pressed('up') then
16
self.velocity.y = -200
20
self.velocity.y = -200 * the.activeMaze.moveMod
17
21
elseif the.keys:pressed('down') then
22
self.velocity.y = 200 * the.activeMaze.moveMod
20
24
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
23
38
onCollide = function(self, other)
24
41
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'