How can i make objects disapear on event
Author |
Message |
Woodbridge
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Delta
![](http://cg-clan.f2g.net/express_slower.gif)
|
Posted: Tue May 27, 2003 9:05 am Post subject: (No 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. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue May 27, 2003 10:55 am Post subject: (No 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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Tue May 27, 2003 1:08 pm Post subject: (No subject) |
|
|
ok here's how objects work(at least for me)
code: |
type ball :
record
x, y : int
visibility : boolean
end record
var ball1 : ball
ball1.x := 1
ball1.y := 1
ball1.visibility := true
loop
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)
cls
end loop
|
the ball1 is an object with these specifications x,y,visibility... |
|
|
|
|
![](images/spacer.gif) |
|
|