Computer Science Canada

How To Make a ball shoot?

Author:  crimson_188 [ Tue Jan 17, 2006 4:50 pm ]
Post subject:  How To Make a ball shoot?

So far i can make a green dot that can move but i cant figure out how to make it shoot...like a dot?
Here is what i have so far:
code:
var x,y,z : int
    x:=40
    y:=80
    z:=1   
        var Soldier : array char of boolean
            loop
            Input.KeyDown (Soldier)
           
        if Soldier (KEY_UP_ARROW) then
    y:=y+5
        end if
        if Soldier (KEY_RIGHT_ARROW) then
    x:=x+5
        end if
        if Soldier (KEY_LEFT_ARROW) then
    x:=x-5
        end if
        if Soldier (KEY_DOWN_ARROW) then
    y:=y-5
        end if
        if Soldier (KEY_DELETE) then
    z:=0
        end if
            drawfilloval(x,y,4,4,green)       
            delay(60)
             cls
            end loop


Any leads would be nice
Thank You

Martin says: Just changed the quote tags to code tags. No worries Smile

Author:  person [ Tue Jan 17, 2006 5:11 pm ]
Post subject: 

crimson_188 wrote:
Any leads would be nice


1) use code tags
2) indent
3)
code:

var a : array char of boolean
loop
    Input.KeyDown (a)
    if a (KEY_UP_ARROW) then
        for x : 1 .. 100
            drawfilloval (0 + x, 0 + x, 5, 5, 1)
            delay (50)
            drawfilloval (0 + x, 0 + x, 5, 5, 0)
        end for
    end if
end loop

Author:  crimson_188 [ Tue Jan 17, 2006 6:20 pm ]
Post subject: 

Thanks for the tips i can get the ball and the shooting but ever time i shoot the ball disappears... how would i fix this?
code:
var a : array char of boolean
var x,y,z : int %Starting point for ball
    x:=40
    y:=80
    z:=1   
        var Soldier : array char of boolean
            loop
            Input.KeyDown (Soldier)
%Ball Movement           
        if Soldier (KEY_UP_ARROW) then
    y:=y+5
        end if
        if Soldier (KEY_RIGHT_ARROW) then
    x:=x+5
        end if
        if Soldier (KEY_LEFT_ARROW) then
    x:=x-5
        end if
        if Soldier (KEY_DOWN_ARROW) then
    y:=y-5
        end if
                if Soldier (KEY_DELETE) then
        for i : 1 .. 1000
            drawfilloval (300 + i, 0 + i, 2, 2, 1)
            delay (8)
            drawfilloval (300 + i, 0 + i, 2, 2, 0)
        end for
        end if
            drawfilloval(x,y,4,4,green)       
            delay(60)
             cls
           
             end loop


Martin says: Just changed the quote tags to code tags.

Author:  person [ Tue Jan 17, 2006 6:55 pm ]
Post subject: 

thats because u have ls in ur code, look at my previous post and see wat i did to erase, do that instead


: