-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.lua
More file actions
34 lines (33 loc) · 1.17 KB
/
update.lua
File metadata and controls
34 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function love.update(dt)
width = love.graphics.getWidth()
height = love.graphics.getHeight()
if love.keyboard.isDown('right') or love.keyboard.isDown('d') then
if map_horizontal <= -1500 then
map_horizontal = map_horizontal
else
direction = 'right'
map_horizontal = map_horizontal - 100 * dt
end
elseif love.keyboard.isDown('left') or love.keyboard.isDown('a') then
if map_horizontal >= 1500 then
map_horizontal = map_horizontal
else
direction = 'left'
map_horizontal = map_horizontal + 100 * dt
end
elseif love.keyboard.isDown('down') or love.keyboard.isDown('s') then
if map_vertical <= -1500 then
map_vertical = map_vertical
else
direction = 'down'
map_vertical = map_vertical - 100 * dt
end
elseif love.keyboard.isDown('up') or love.keyboard.isDown('w') then
if map_vertical >= 1500 then
map_vertical = map_vertical
else
direction = 'up'
map_vertical = map_vertical + 100 * dt
end
end
end