Computer Science Canada

How can i make objects disapear on event

Author:  Woodbridge [ Tue May 27, 2003 8:43 am ]
Post subject:  How can i make objects disapear on event

I am making a pong game and i cannot figure out how to make the blocks disapear when they are hit by the ball.
Can somone help me out.

Author:  Delta [ Tue May 27, 2003 9:05 am ]
Post subject: 

First off your game is called blast out or something like that not pong, but sure. Make a procedure that is called when the [x,y] of the ball is beside or in the [x1,y1,x2,y2] of the box. Then have the procedure draw over the box and set the [x1,y1,x2,y2] values off the screen so that the ball can't hit them anymore.

Author:  Tony [ Tue May 27, 2003 10:55 am ]
Post subject: 

i sujest keeping all block positions in an array and once the block is hit (rectangle collision detection) you set that array item as 0

Author:  Homer_simpson [ Tue May 27, 2003 1:08 pm ]
Post subject: 

ok here's how objects work(at least for me)

type ball :
        x, y : int
        visibility : boolean
    end record

var ball1 : ball
ball1.x := 1
ball1.y := 1
ball1.visibility := true
    ball1.x += 1
    ball1.y += 1
    if ball1.x > 300 then
        ball1.visibility := false
        put "=O the event happend and the ball is invisible"
    end if

    if ball1.visibility then
        drawfilloval (ball1.x, ball1.y, 10, 10, 12)
    end if
    delay (10)
end loop

the ball1 is an object with these specifications x,y,visibility...