1
-- Just something quick for Mike Tyson's Punch Out!!
2
-- Intended to help time hits in real time.
6
local EHP= 0x0398 -- Enemy HP address
7
local TMR= 23 -- Frames in advance for your punches.
8
local BND= -8 -- KEEP NEGATIVE!! Frames after the golden zone.
9
local threshold= 15-- How many frames before the target timing does it allow?
13
local DISPx2= DISPx+11 -- Right side of box. Adjust that plus to your need
14
local DisplayBar= true
27
local HitTiming= BND-1
29
--*****************************************************************************
31
--*****************************************************************************
33
if EnemyHP < lastEHP then
43
--*****************************************************************************
45
--*****************************************************************************
46
LastButtons["A"]= Buttons["A"]
47
LastButtons["B"]= Buttons["B"]
48
LastButtons["select"]= Buttons["select"]
50
Buttons= joypad.get(1)
51
if (Buttons["A"] and not LastButtons["A"]) or (Buttons["B"] and not LastButtons["B"]) then
58
--*****************************************************************************
60
--*****************************************************************************
61
EnemyHP= memory.readbyte(EHP)
62
gui.text(144,22,EnemyHP)
65
if LastHit <= threshold and LastHit >= BND then
70
accuracy= accuracy + HitTiming
72
elseif HitTiming < 0 then
73
accuracy= accuracy - HitTiming
81
if Buttons["A"] or Buttons["B"] then
101
elseif i == HitTiming and timer < 0 then
103
gui.text(100,80,"early " .. i)
105
gui.drawbox(DISPx, DISPy-3 - 4*i,DISPx2, DISPy-1 - 4*i,color)
108
if HitTiming == 0 and timer < 0 then
109
gui.text(128,80,"OK")
110
gui.drawbox(128,80,144,90,"green")
112
if (timer % 3) == 0 then
114
elseif (timer % 3) == 1 then
117
gui.drawbox(DISPx , DISPy , DISPx2, DISPy+2, color)
118
gui.drawbox(DISPx-2, DISPy-2, DISPx2+2, DISPy+4, color)
124
gui.drawbox(DISPx , DISPy ,DISPx2, DISPy+2,color)
125
gui.drawbox(DISPx-2, DISPy-2,DISPx2+2, DISPy+4,"white")
132
elseif i == HitTiming and timer < 0 then
134
gui.text(146,80,"late " .. -i)
136
gui.drawbox(DISPx, DISPy+3 - 4*i,DISPx2, DISPy+5 - 4*i,color)
140
if Buttons["select"] and not LastButtons["select"] then
147
gui.text(5,120,"Timing error: " .. accuracy)
148
gui.text(5,140,"Perfect hits: " .. perfect)
149
gui.text(5,160,"Early: " .. earlies)
150
gui.text(5,170,"Late: " .. lates)
b'\\ No newline at end of file'