fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

BkacjiosMerge branch 'master' of https://github.com/bkacjios/m-overlayc7d88f9

v2.1.3
530 B24 linesraw
1-- Pac-Man World 2 (NTSC v1.0)
2
3local core = require("games.core")
4
5local game = core.newGame(0x8037B3C0)
6
7local abs = math.abs
8
9function game.translateJoyStick(x, y)
10	x = x/127
11	y = y/127
12
13	local near = 1 - (abs(abs(x) - abs(y))) * 0.100
14
15	local angle = math.atan2(x, y)
16	local mag = math.sqrt(x*x + y*y)
17
18	-- Reduce the magnitute when x,y values are headed towards a diagonal
19	return x + math.sin(angle) * mag * near * 0.25, y + math.cos(angle) * mag * near * 0.25
20end
21
22game.translateCStick = game.translateJoyStick
23
24return game