bzr branch
http://9ix.org/bzr/ld26
5
by Josh C
load a level, move a player around |
1 |
Player = Tile:extend { |
2 |
image = 'data/player1.png', |
|
3 |
onNew = function(self) |
|
4 |
end, |
|
5 |
onStartFrame = function(self) |
|
6 |
if the.keys:pressed('up') then |
|
7 |
self.velocity.y = -100 |
|
8 |
elseif the.keys:pressed('down') then |
|
9 |
self.velocity.y = 100 |
|
10 |
else |
|
11 |
self.velocity.y = 0 |
|
12 |
end |
|
13 |
||
14 |
if the.keys:pressed('right') then |
|
15 |
self.velocity.x = 100 |
|
16 |
elseif the.keys:pressed('left') then |
|
17 |
self.velocity.x = -100 |
|
18 |
else |
|
19 |
self.velocity.x = 0 |
|
20 |
end |
|
21 |
end |
|
22 |
} |