Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/Assets/Lua/NES/ZapperTarget.lua
2 views
1
-- Draws a target on screen representing the x,y coordinates of the Zapper plugged into the 2nd port
2
3
while true do
4
buttons = joypad.get();
5
x = buttons["P2 Zapper X"];
6
y = buttons["P2 Zapper Y"];
7
fired = buttons["P2 Fire"];
8
9
color = "white";
10
if fired then
11
color = "red";
12
end
13
14
gui.drawLine(x - 4, y + 4, x + 4, y - 4, color);
15
gui.drawLine(x + 4, y + 4, x - 4, y - 4, color);
16
gui.drawEllipse(x - 5, y - 5, 10, 10, color);
17
gui.drawPixel(x, y, "red");
18
gui.drawEllipse(x - 1, y - 1, 2, 2, "red");
19
emu.frameadvance()
20
end
21