
-----------------------------------
battleroyale
Sun May 29, 2005 11:21 am

how do you make 2 objects move at the same time
-----------------------------------
Im making this soccer game (more like pong...but who cares) and i cant seem to make the person shoot and still move. The person (a box righ now) can move up and down and sideways, and when you shooot the ball (another box) the ball moves forward but then the person does not move. I made the ball move in a loop......exits when it is >640, after that i can move again...here i the part

drawbox (0, 0, 30, 20, 7)
takepic (0, 0, 100, 100, enterprise)


loop


    Input.KeyDown (chars)
    
    locate (1, 1)


    if chars ('w') then

        cls
        drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)
        enterprise_move_ud += 5
        if enterprise_move_ud > 449 then
            enterprise_move_ud := 449
        end if


        delay (10)

    end if




    if chars ('s') then
        cls
        drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)
        enterprise_move_ud -= 5
        if enterprise_move_ud < 10 then
            enterprise_move_ud := 10
        end if
        delay (10)

    end if




    if chars ('d') then
        cls
        drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)
        enterprise_move_lr += 5
        if enterprise_move_lr > 605 then
            enterprise_move_lr := 605
        end if
        delay (10)

    end if

    if chars ('a') then
        cls
        drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)
        enterprise_move_lr -= 5
        if enterprise_move_lr < 0 then
            enterprise_move_lr := 0
        end if
        delay (10)

    end if


    mousewhere (click_x, click_y, click_c)
    if click_c = 1 then

        drawline (enterprise_move_lr + 10, enterprise_move_ud + 15, click_x, click_y, 4)
        delay (15)
        cls
        drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)

    end if

    if chars('e') then


        photon_x := enterprise_move_lr
        photon_y := enterprise_move_ud - 5
        photon_x2 := enterprise_move_lr + 5
        photon_y2 := enterprise_move_ud
        var photon : array 1 .. sizepic (photon_x, photon_y, photon_x2, photon_y2) of int
        drawbox (photon_x, photon_y, photon_x2, photon_y2, 7)
        takepic (photon_x, photon_y, photon_x2, photon_y2, photon)



        loop
            photon_x += 5
            photon_x2 += 5
            drawpic (photon_x, photon_y, photon, 0)
            delay (10)
            cls
            drawpic (enterprise_move_lr, enterprise_move_ud, enterprise, 0)

            delay (10)


            exit when photon_x > 640
        end loop

    end if

help me...

ps...it was suppose to be a star trek game at first...but i gave up

-----------------------------------
StarGateSG-1
Sun May 29, 2005 4:39 pm


-----------------------------------
Thinking ... post in a few

Use procedures, look them up in help.

-----------------------------------
Tony
Sun May 29, 2005 4:49 pm

Re: how do you make 2 objects move at the same time
-----------------------------------
the person does not move. I made the ball move in a loop......exits when it is >640, after that i can move again...
Do you move your character inside of that ball loop? No.. then your character is not supposed to move, just the ball.

Perhaps you want to place your ball and character inside of the same loop.
