Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How can i make objects disapear on event
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Woodbridge




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: 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.
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: