-
Notifications
You must be signed in to change notification settings - Fork 3
/
input.lua
60 lines (60 loc) · 1.38 KB
/
input.lua
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- input.lua
function m()
end
------------
function k()
-- Object. (Arrow keys)
if Keyboard:is_pressed(KEY_UP) then
player:move(0, 0.1)
end
--------------------------
if Keyboard:is_pressed(KEY_DOWN) then
-- position = position + vel * dt
player:move(0, -0.1)
end
--------------------------
if Keyboard:is_pressed(KEY_LEFT) then
player:move(-0.1, 0)
end
--------------------------
if Keyboard:is_pressed(KEY_RIGHT) then
player:move(0.1, 0)
end
--------------------------
-- Camera. (W,A,S,D [Z,X])
if Keyboard:is_pressed(0x57) then -- W
camera:move(0, 5, 0)
end
--------------------------
if Keyboard:is_pressed(0x41) then -- A
camera:strafe(-5)
end
--------------------------
if Keyboard:is_pressed(0x53) then -- S
camera:move(0, -5, 0)
end
--------------------------
if Keyboard:is_pressed(0x44) then -- D
camera:strafe(5)
end
--------------------------
-- Spacebar.
if Keyboard:is_pressed(0x20) then
end
if Keyboard:is_released(0x20) then
end
--------------------------
-- Switch
if Keyboard:is_pressed(0x31) then
end
if Keyboard:is_pressed(0x32) then
end
if Keyboard:is_pressed(0x33) then
end
if Keyboard:is_pressed(0x34) then
end
end
------------
keyboard = k
mouse = m
------------