
-----------------------------------
funnyface43
Sat Apr 06, 2013 4:44 pm

Pong Help
-----------------------------------
What is it you are trying to achieve?
I am trying to get the ball to bounce off the paddle and fix the paddles because they stopped moving.


What is the problem you are having?
I can't get the paddles to move and get the ball to bounce off the paddles.


Describe what you have tried to solve this problem
I have tried moving some codes around and searching through other codes but i still can't get it.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




%Variables
var intfont:int
var y1,y2,y3,y4:int
var x1,x2,x3,x4:int
var x:int:=maxx div 2
var y:int:=maxy div 2-25
var r1,r2:int:=2
var dx,dy:int:=1

%Background
drawfillbox(0,0,maxx,maxy,black)

%Score
drawbox(0,maxy-50,maxx,maxy,white)
drawline(maxx div 2,maxy-50,maxx div 2,maxy,white)
intfont:=Font.New("Segoe Print:18")
Font.Draw("Player 1",5,maxy-25,intfont,white)
intfont:=Font.New("Segoe Print:18")
Font.Draw("Player 2",maxx-95,maxy-25,intfont,white)

%Center Line
loop
for count:1..374 by 10
drawdot(maxx div 2,count,white)
end for

%Paddles and Ball
y1:=150
y2:=200
y3:=150
y4:=200
x1:=5
x2:=10
x3:=maxx-5
x4:=maxx-10
var chars:array char of boolean
View.Set ("offscreenonly")

        Input.KeyDown (chars)
        
        if chars ('w') then
            y1:=y1+5
            y2:=y2+5
            if y1 >=maxy-100 then
                y1:=maxy-100
                y2:=maxy-51
            end if
        end if
        if chars ('s') then
            y1:=y1-5
            y2:=y2-5
            if y1 =maxy-100 then
                y3:=maxy-100
                y4:=maxy-51
            end if
        end if
        if chars (KEY_DOWN_ARROW) then
            y3:=y3-5
            y4:=y4-5
            if y3 = maxy - 100 then
            y1 := maxy - 100
            y2 := maxy - 51
        end if
    end if
    if chars ('s') then
        y1 := y1 - 5
        y2 := y2 - 5
        if y1 = maxy - 100 then
            y3 := maxy - 100
            y4 := maxy - 51
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        y3 := y3 - 5
        y4 := y4 - 5
        if y3 = y3 then
            if (y + r2) = maxy - 100 then
            y1 := maxy - 100
            y2 := maxy - 51
        end if
    end if
    if chars ('s') then
        y1 := y1 - 5
        y2 := y2 - 5
        if y1 = maxy - 100 then
            y3 := maxy - 100
            y4 := maxy - 51
        end if
    end if
    if chars (KEY_DOWN_ARROW) then
        y3 := y3 - 5
        y4 := y4 - 5
        if y3 = y3 then
            if (y + r2) 