this is the latest version
change some more things and now its easier to configurate it like you want
edit: included ingame difficult config for those who cant change the code (compiled version)
- added impossible mode (believe me, it is

)
Code:
;configuration area:
color1 = Lime ; color of the players paddle, colorname or hexcode
color2 = Lime ; color of the computer paddle, "
color3 = Lime ; color of the ball, "
transparent_background = 0 ; enter 1 to have a complete transparent background, 0 for a black bg
random_angle = 15 ; determines angle of incidence = angle of reflection, if 0 it is mathematicaly
; correct, 50 or more is totaly random
;end of configuration
;ingame config
gui, 3:default
gui, margin, 15 ,15
gui, font, s13
Gui, Add, Text,, Instructions:
gui, font, s10
gui, add, text,, F1 for help.`nLeft Mouseclick to start the ball`nP for Pause`nCtrl+x for exit`nS to toggle sound on/off
gui, font, s13
Gui, Add, Text,, Choose your difficulty:
gui, font, s10
Gui, Add, Button, gBeg w350 h25 x20 y200, Beginner
Gui, Add, Button, gInt wp hp xp yp+30, Intermediate
Gui, Add, Button, gHard wp hp xp yp+30, Hard
Gui, Add, Button, gimp wp hp xp yp+30, Impossible
Gui, Show,autosize, Ping Pong
return
Beg:
pc_difficulty = 30
pc_board_speed = 15
ball_speed = 15
ball_increasing_speed = 2
gui, destroy
goto go_ahead
return
Int:
pc_difficulty = 20
pc_board_speed = 23
ball_speed = 23
ball_increasing_speed = 4
gui, destroy
goto go_ahead
return
Hard:
pc_difficulty = 1
pc_board_speed = 30
ball_speed = 30
ball_increasing_speed = 5
gui, destroy
goto go_ahead
return
imp:
imp =1
pc_difficulty = 1
pc_board_speed = 30
ball_speed = 35
ball_increasing_speed = 7
gui, destroy
goto go_ahead
return
go_ahead:
#persistent
SetWorkingDir, %A_ScriptDir%
IfNotExist, pong_board_bounce.wav, UrlDownloadToFile
, http://www.autohotkey.net/~Lequi/pong_board_bounce.wav
, pong_board_bounce.wav
IfNotExist, pong_goal.wav, UrlDownloadToFile
, http://www.autohotkey.net/~Lequi/pong_goal.wav
, pong_goal.wav
IfNotExist, pong_wall_bounce.wav, UrlDownloadToFile
, http://www.autohotkey.net/~Lequi/pong_wall_bounce.wav
, pong_wall_bounce.wav
SW := A_ScreenWidth
SH := A_ScreenHeight
SW_2 := A_ScreenWidth/2
SH_2 := A_ScreenHeight/2
right_goal := SW-30
right_block := SW-80
lower_bounce := SH-20
xpos_board2 := SW-50
points0= 0
points1= 0
check= 1
sound = 1
gui,1:default
DllCall("ShowCursor", UInt,False )
if transparent_background
{
Gui, +LastFound
WinSet, TransColor, Black
}
gui, +toolwindow +alwaysontop
gui, color, black
temp := SW_2-0.1*SW
gui, font, s35
Gui, Add, Text, -wrap vstats cLime x%temp% y50 w200, %points0% : %points1%
temp := SW_2-100
temp2 := SH_2-50
Gui, add, text, vpause cLime x%temp% y%temp2%, Paused
guicontrol, hide, pause
gui, add, progress, Background%color3% vball w20 h20 x%sw_2% y%sh_2%
temp := SH_2-50
gui, add, progress, Background%color1% vboard1 x50 y%temp% w30 h100
gui, add, progress, Background%color2% vboard2 x%xpos_board2% y%temp% w30 h100
temp := SW-0.1*SW
gui, font, s15
gui, add, text, vvsound cgray x%temp% y30, Sound: On
gui, show, w%sw% h%sh%
settimer, mousemove, 10
settimer, pcmove, %pc_difficulty%
settimer, balance, 3000
if SW < 1300
offset := ball_speed-5
else
offset := ball_speed
goto init
return
init:
KeyWait, LButton, D
if check
goto start
return
start:
check=0
pi := (4*Atan(1))
loop
{
random, angle, 0, 360
;msgbox %angle%
if angle between 45 and 135
continue
if angle between 225 and 315
continue
else
break
}
goto move
return
mousemove: ;player board moving
if not check
{
mousegetpos,, mousey
mousey -= 65
guicontrol, move, board1, x50 y%mousey%
}
return
pcmove:
GuiControlGet, board2, Pos
GuiControlGet, ball, Pos
bally -= 50
if xpos < %SW_2% ; ball in player half
{
dif := abs(board2y - SH_2)
if dif < 20
pc_offset =0
else
pc_offset = %pc_board_speed%
if board2y < %SH_2%
{
pc_ypos := board2y + pc_offset
}
else
{
pc_ypos := board2y - pc_offset
}
guicontrol, move, board2, x%xpos_board2% y%pc_ypos%
}
else ; ball in pc's half
{
dif := abs(board2y - bally)
if dif < 20
pc_offset =0
else
pc_offset = 20
if board2y < %bally%
{
pc_ypos := board2y + pc_offset
}
else
{
pc_ypos := board2y - pc_offset
}
if imp
guicontrol, move, board2, x%xpos_board2% y%bally%
else
guicontrol, move, board2, x%xpos_board2% y%pc_ypos%
}
return
move: ;ball moving
loop
{
rad := angle * pi/180
GuiControlGet, ball, Pos
xpos := ballx + cos(rad)*offset
ypos := bally + sin(rad)*offset
guicontrol, move, ball, x%xpos% y%ypos%
if bounce
{
offset -=30
bounce =0
}
sleep 1
;bounce
random, rnd, -%random_angle%, %random_angle%
if xpos > %right_block% ;right side block
{
diff := ypos-pc_ypos
if diff between 0 and 100
{
bounce = 1
offset += 30
if sound
soundplay, %a_workingdir%\pong_board_bounce.wav
angle := 180-angle+rnd
}
}
if xpos > %right_goal% ;right side goal
{
if sound
soundplay, %a_workingdir%\pong_goal.wav
points0++
GuiControl,, stats, %points0% : %points1%
guicontrol, move, ball, x%sw_2% y%sh_2%
bounce =0
if SW < 1300
offset := ball_speed-5
else
offset := ball_speed
KeyWait, LButton, D
goto start
}
if xpos < 90
{
diff := ypos-mousey
if diff between -30 and 100 ;left side block
{
bounce = 1
offset += 30
if sound
soundplay, %a_workingdir%\pong_board_bounce.wav
angle := 180-angle+rnd
}
}
if xpos < 30 ;left side goal
{
if sound
soundplay, %a_workingdir%\pong_goal.wav
points1++
GuiControl,, stats, %points0% : %points1%
guicontrol, move, ball, x%sw_2% y%sh_2%
bounce =0
if SW < 1300
offset := ball_speed-5
else
offset := ball_speed
KeyWait, LButton, D
goto start
}
if ypos > %lower_bounce% ;lower side
{
bounce = 1
offset += 30
if sound
soundplay, %a_workingdir%\pong_wall_bounce.wav
angle := 360-angle+rnd
}
if ypos < 0 ;upper side
{
bounce = 1
offset += 30
if sound
soundplay, %a_workingdir%\pong_wall_bounce.wav
angle := 360-angle+rnd
}
}
return
balance:
offset+= %ball_increasing_speed%
return
#IfWinActive, ahk_class AutoHotkeyGUI
s:: ;sound toggle
if sound
{
sound = 0
guicontrol, , vsound, Sound:%a_space%Off
}
else
{
sound = 1
guicontrol, , vsound, Sound:%a_space%On
}
return
#IfWinActive, ahk_class AutoHotkeyGUI ;help
F1::
gui, 1:-alwaysontop
gui, 2:margin, 15 ,15
gui, 2:destroy
gui, 2:font, s13
gui, 2:add, text, , Left Mouseclick to start the ball`nP for Pause`nStrg+x for exit`nS to toggle sound on/off
gui, 2:add, button, default yp+90 x100, Close
gui, 2:show, autosize, Help
return
2ButtonClose:
2guiclose:
2guiescape:
gui, 2:destroy
gui,1: +alwaysontop
return
#IfWinActive, ahk_class AutoHotkeyGUI ;pause
p::
gui, 1:-alwaysontop
DllCall("ShowCursor", UInt,True )
guicontrol, show, pause
settimer, mousemove, off
settimer, pcmove, off
settimer, balance, off
sleep, 200
KeyWait, P, D
gui, 1:+alwaysontop
DllCall("ShowCursor", UInt,false )
guicontrol, hide, pause
settimer, mousemove, on
settimer, pcmove, on
settimer, balance, on
return
#IfWinActive, ahk_class AutoHotkeyGUI ;exit
3guiclose:
guiclose:
^x::
DllCall("ShowCursor", UInt,True )
exitapp
return