-
Notifications
You must be signed in to change notification settings - Fork 0
/
lemmings.lua
62 lines (52 loc) · 1.57 KB
/
lemmings.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
61
62
function LEMMINGSMouse()
inp = input.get()
pad = joypad.get(1)
offset = -4 -- to center the mousecursor
minx = 0
miny = 0
maxx = 246
maxy = 214
--gui.text(2, 60, memory.readbyte(0x7E0071))
if(inp.xmouse+offset >= minx and inp.xmouse+offset <= maxx) then
memory.writebyte(0x7E0071,inp.xmouse+offset)
elseif(inp.xmouse+offset < minx) then
memory.writebyte(0x7E0071,minx)
elseif(inp.xmouse+offset > maxx) then
memory.writebyte(0x7E0071,maxx)
end
--gui.text(2, 70, inp.xmouse+offset)
--gui.text(2, 100, memory.readbyte(0x7E0073))
if(inp.ymouse+offset >= miny and inp.ymouse+offset <= maxy) then
memory.writebyte(0x7E0073,inp.ymouse+offset)
elseif(inp.ymouse+offset < miny) then
memory.writebyte(0x7E0073,miny)
elseif(inp.ymouse+offset > maxy) then
memory.writebyte(0x7E0073,maxy)
end
--gui.text(2, 110, inp.ymouse+offset)
if (inp.xmouse+offset >= maxx) then
pad.right = true
joypad.set(1,pad)
end
if (inp.xmouse+offset <= minx) then
pad.left = true
joypad.set(1,pad)
end
if (inp.ymouse+offset >= maxy) then
pad.down = true
joypad.set(1,pad)
end
if (inp.ymouse+offset <= miny) then
pad.up = true
joypad.set(1,pad)
end
if (inp.leftclick) then
pad.A = true
joypad.set(1,pad)
end
if (inp.rightclick) then
pad.start = true
joypad.set(1,pad)
end
end
gui.register(LEMMINGSMouse)