
-----------------------------------
Schaef
Sat Dec 13, 2003 12:52 am

Pong Scoring Problem
-----------------------------------
Ok, here is my pong game so far.. I am having trouble getting the score to go up when the ball hits 0 or maxx.  Take a look at my code and try and find out what the problem is..


 % PONG GAME

View.Set ("graphics:600;500, offscreenonly, nobuttonbar")

var a, b, c, d, e, f, g, introf : int
a := 200
b := 200
c := 10
d := 100
e := 0
f := 100
g := 0
var m : array char of boolean
var m2 : array char of boolean
introf := Font.New ("North Point:50:bold")
var xstep:int:=1
var ystep:int:=1

proc intro


    for i : -10 .. 100
        drawfilloval (i, 250, 10, 10, 2)
        View.Update
        if i < 100 then
            cls
        end if
    end for
    delay (500)
    drawfilloval (150, 250, 10, 10, 4)
    View.Update
    delay (500)
    drawfilloval (200, 250, 10, 10, 16)
    View.Update
    delay (500)
    drawfilloval (250, 250, 10, 10, 16)
    View.Update
    delay (500)
    drawfilloval (300, 250, 10, 10, 16)
    View.Update
    delay (500)
    introf := Font.New ("North Point:50:bold")
    Font.Draw ("d", 350, 240, introf, grey)
    View.Update
    Font.Draw ("sOFT", 380, 240, introf, black)
    View.Update
    delay (2000)
end intro

process scoring
var p2,p1:int
p2:=0
p1:=0
loop
put "P1:",p1
put "P2:",p2
if a-10=maxx then
p1:=p1+1
end if

delay(1)
cls
end loop
end scoring

% Moving Ball
process ball
    loop
      a:=a+xstep
      b:=b+ystep
      Draw.FillOval(a,b,10,10,0)
      delay(5)
      Draw.FillOval(a,b,10,10,12)
      if a+15>=maxx then
      xstep:=-1
      elsif a-15=maxy then
      ystep:=-1
      elsif b-15=maxx and b=g then
      xstep:=a-1
      elsif a-10