
-----------------------------------
InViZable
Sun Jan 16, 2011 6:19 pm

How would you make the balls drop to the ground after drawing and make the other balls bounce off of the green balls??
-----------------------------------
What is it you are trying to achieve?
I am trying to allow the green balls fall down to the floor after drawing them


What is the problem you are having?
I can't get the balls to drop to the floor


Describe what you have tried to solve this problem
I have tried to rearrange loops, try new codes... basically everything


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




setscreen ("graphics:640;480,nocursor")
%Declare Variables
var X, Y, B, r, count, xdir, ydir, xpos, ypos, xdir1, ydir1, xpos1, ypos1, mypic, xmouse, ymouse, bnumvar, budvar, font1, total,total1,total2,total3 : int
%Declare what each variable is
font1 := Font.New ("Serif:12")
mypic := Pic.FileNew ("grey.jpg")
r := 0
count := 15
xdir := 1
ydir := 2
xpos := 50
ypos := 100

xdir1 := 2
ydir1 := 2
xpos1 := 100
ypos1 := 45


%Process greenball
process greenball
    loop
        loop
        %Get mouse location
            Mouse.Where (X, Y, B)
            %Drawball
            if B = 1 and X < 620 and X > 20 and Y > 20 and Y < 400 then

                drawfilloval (X, Y, r, r, 2)
                drawoval (X, Y, r, r, 7)
                delay (20)
                drawfilloval (X, Y, r, r, 0)
                r := r + 1

            end if
            total := r + X
            total1:= r + Y
            total2:= Y- r
            total3:= X - r
            %Exit statment
            exit when B = 0 or r + X = 620 or X - r = 20 or r + Y = 400 or Y - r = 20
        end loop
%Draw the circles again
        drawfilloval (X, Y, r, r, 2)
        drawoval (X, Y, r, r, 7)
        delay (20)
        Y:=Y - 1
        %Reset the radius
        r := 0
        %total := r + X
    end loop
end greenball
%Draw the borders
drawfillbox (0, 0, 20, 480, 7)
drawfillbox (0, 0, 640, 20, 7)
drawfillbox (620, 0, 640, 480, 7)
drawfillbox (0, 400, 640, 480, 7)
drawfillbox (40, 430, 100, 450, 27)
Font.Draw ("Pause", 50, 435, font1, 0)
fork greenball
loop
%Get grey background
    Pic.Draw (mypic, 20, 20, picUnderMerge)
    %If statments for the bouncing balls
    if xpos >= 610 or xpos = 610 or xpos1 = 390 or ypos = 390 or ypos1 