
-----------------------------------
Code_Urban
Wed Nov 03, 2004 11:43 pm

I NEED HELP....and fast(pong game)
-----------------------------------
I need a pong game...im in grd 10 and we are making pong..and ive checked ur Source Codes and there 2 advance for me and my classs....i need sumthing thats extremely basic commands....this is what i have...and i need help like hell and these are the commands we basically using...

View.Set ("graphics:640:480")
var ballx, bally, xrad, yrad : int
var xstep, ystep, y1, y2, pmove, x1, x2 : int
var colourpad, colourpad1, ballcolour, ballcolour1 : int
var key : string (1)
ballx := 310
bally := 270
xrad := 5
yrad := 5
ballcolour := 2
ballcolour1 := 0
ystep := 8
xstep := 10
pmove := 10
y1 := 200
y2 := 170
x1 := 20
x2 := 620
colourpad := 12
colourpad1 := 0

loop
    drawfillbox (0, 640, 0, 480, 43)
    drawfilloval (ballx, bally, xrad, yrad, ballcolour)
    drawfillbox (x1, y1, x1 - 10, y1 + 50, colourpad)
    drawfillbox (x2, y1, x2 + 10, y1 + 50, colourpad)
    View.Update
    delay (40)
    drawfillbox (0, 640, 0, 480, 43)
    drawfilloval (ballx, bally, xrad, yrad, ballcolour1)
    drawfillbox (x1, y1, x1 - 10, y1 + 50, colourpad1)
    drawfillbox (x2, y1, x2 + 10, y1 + 50, colourpad1)
    ballx := ballx + xstep
    bally := bally + ystep

    %Left Paddle MOVE
    if hasch then
        getch (key)
        if key = "w" or key = "W" and y1 < 420 then
            y1 := y1 + 20
        elsif key = "s" or key = "S" and y1 > 0 then
            y1 := y1 - 20
        end if
        %Right Paddle MOVE
        if hasch then
            getch (key)
            if key = chr (200) and y2 < 420 then
                y2 := y2 + 20
            elsif key = chr (208) and y2 > 0 then
                y2 := y2 - 20
            end if
            %Wall Bounce
            if ballx > 630 or ballx < 5 then
                xstep := -xstep
            end if
            if bally > 475 or bally < 5 then
                ystep := -ystep
            end if
        end if
    end if
end loop

the ball wont bounce, if i use w and s BOTH padlles move plus the go off the screen, but my basics concern is my ball bouncing off the screen...so if some1 can reply...plz.. and thank you..and i need help bad!!

peace

Code Urban

-----------------------------------
apomb
Thu Nov 04, 2004 12:31 am


-----------------------------------
first of all, im just going to say what is needed to say ... too late for reading un-tagged code... ne way 
1-use tags
2-use KEY_DIRECTION cmd, F10 works perfectly for finding this!
3- dont hardcode so much, try some for loops and maxy/maxx for boundaries
4- (interchangeable with 3) draw a border ... then use whatdotcolor
to find boundaries ... also for paddles

hope this is not too complicated ... and it helps

-CompWiz

-----------------------------------
cop_mike
Thu Nov 04, 2004 3:38 pm


-----------------------------------
dave!!!   lol i need help to  so everyone heres my pong game     i need to know how to score the points  in the game easily and shit like that can u guys help me finish my game  can u help me ??!?!?!?!?!




View.Set ("graphics:640;480")


var x, y, xr, yr, c, x1, y1, x2, y2 : int
var xstep, ystep : int := 5
var key : string (1)
ystep := 6
x := 480
y := 240
xr := 8
yr := 8
x1 := 10
y1 := 240
x2 := 620
y2 := 240
loop
randint (c,10,69)
drawfillbox (640, 420, 0, 480, c)

%ball
    drawfilloval (x, y, xr, yr, c)
    % right paddle
    drawfillbox (x1, y1, x1 + 10, y1 + 60,c )
    %left paddle
    drawfillbox (x2, y2, x2 + 10, y2 + 60, c)
    delay (30)
    % clear ball
    drawfilloval (x, y, xr, yr, 0)
    %clear right paddle
    drawfillbox (x1, y1, x1 + 10, y1 + 60, 0)
    %clear left paddle
    drawfillbox (x2, y2, x2 + 10, y2 + 60, 0)
    x := x + xstep
    y := y + ystep
    if hasch then
        getch (key)
        if key = "W" or key = "w" and y1 < 350 then
            y1 := y1 + 20
        elsif key = "S" or key = "s" and y1 > 0 then
            y1 := y1 - 20
        elsif key = chr (200) and y2 < 350 then
            y2 := y2 + 20
        elsif key = chr (208) and y2 > 0 then
            y2 := y2 - 20
        end if
    end if
   %bounces ball off walls
         if x > 630 or x < 10 then
        xstep := -xstep
    end if
    if y > 410 or y < 10 then
        ystep := -ystep
    end if
   %makes bal bounce off paddles
if x - 8 = y1 and y = x2 then
        if y >= y2 and y 