Tabs: Code Editor Console Output Graphical Output View Help
Toolbar: Run!
NOTE Pong Clone in EASI (Vishwesh Anand 2014) NOTE WASD controls the paddle, be sure to focus keyboard input on Graphical Output Screen NOTE py is vertical position of player, oy is vertical position of AI opponent NOTE ax is horizontal position of ball, ay is vertical position of ball NOTE ax is horizontal velocity of ball, ay is vertical velocity of ball create py set to 200 create oy set to 220 create xb set to 360 create yb set to 240 create ax set to -4 create ay set to 0 game loop clear graph if (key_pressed="w") set py to py + 10 else if (key_pressed="s") set py to py - 10 end if if py > 460 set py to 480 - py else if py < -20 set py to 480 + py end if set ax to ax * 1.001 set ay to ay * 1.001 if xb < 40 or xb > 680 or yb > 470 or yb < 10 if (yb > py-10 and yb <= py+30 and xb < 40) or (yb > oy-10 and yb <= oy+30 and xb > 680) set ax to ax * -1 set ay to (ay+4) * -1 else if (yb >= py+30 and yb < py+90 and xb < 40) or (yb >= oy+30 and yb < oy+90 and xb>680) set ax to ax * -1 set ay to (ay-4) * -1 else if xb > 700 or xb < 10 set xb to 360 set yb to 240 if ax > 0 set ax to 4 else set ax to -4 end if set ay to 0 else if (yb > 470 or yb < 10) and (xb > 40 or xb < 470) set ay to ay * -1 set ax to ax / 1.001 set ay to ay / 1.001 else set ax to ax / 1.001 set ay to ay / 1.001 end if end if set oy to yb - 40 set xb to xb + ax set yb to yb + ay draw rectangle at (5, py) 20 by 80 color green draw circle at (xb, yb) radius 10 color blue draw rectangle at (695, oy) 20 by 80 color red end game loop