bzr branch
http://9ix.org/bzr/ld26
5
by Josh C
load a level, move a player around |
1 |
Player = Tile:extend { |
9
by Josh C
levels hash, scale player |
2 |
image = 'data/player-null.png', |
5
by Josh C
load a level, move a player around |
3 |
onNew = function(self) |
9
by Josh C
levels hash, scale player |
4 |
the.player = self |
5 |
||
6 |
self.movementScale = self.height / 32 |
|
7 |
||
8 |
--self.scale = self.scaleHeight / self.height |
|
9 |
--self.width = self.height * .826 |
|
10 |
--self.width = self.width * self.scale |
|
11 |
--self:updateQuad() |
|
5
by Josh C
load a level, move a player around |
12 |
end, |
13 |
onStartFrame = function(self) |
|
14 |
if the.keys:pressed('up') then |
|
15 |
self.velocity.y = -100 |
|
16 |
elseif the.keys:pressed('down') then |
|
17 |
self.velocity.y = 100 |
|
18 |
else |
|
19 |
self.velocity.y = 0 |
|
20 |
end |
|
21 |
||
22 |
if the.keys:pressed('right') then |
|
23 |
self.velocity.x = 100 |
|
24 |
elseif the.keys:pressed('left') then |
|
25 |
self.velocity.x = -100 |
|
26 |
else |
|
27 |
self.velocity.x = 0 |
|
28 |
end |
|
29 |
end |
|
30 |
} |