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

Username:   Password: 
 RegisterRegister   
 Could you take a look at this
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Josh_VK




PostPosted: Sat May 22, 2004 6:39 pm   Post subject: Could you take a look at this

Ive got most the coding for a pong game where you hit the bricks aka. androids or whatever.. but im haveing trouble making the ball reflect and clear the ball.. i think im just not seeing something. if someone could just look this over and find my mistake id apreciate it.. if you run it youll see what i mean..


jong1.1.t
 Description:
rund and look

Download
 Filename:  jong1.1.t
 Filesize:  3.64 KB
 Downloaded:  105 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat May 22, 2004 8:32 pm   Post subject: (No subject)

umm... yeah... your box is hardcoded it seems. You draw it every time and you never check if it is still there or not.

you suppost to have an array of boxes and if one gets destroyed, you mark that array element as so
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Josh_VK




PostPosted: Sat May 22, 2004 11:08 pm   Post subject: (No subject)

Ok im not sure if i get what you mean?... so i set an array for draw box or? anyone else can help?
SuperGenius




PostPosted: Sun May 23, 2004 9:02 pm   Post subject: (No subject)

i think what tony intends for you to do is set up a 2d array that holds the status of the bricks, and when one is hit you change that specific value of the array to reflect that, and update the bricks.
Josh_VK




PostPosted: Mon May 24, 2004 1:40 am   Post subject: (No subject)

My Brain Hurts
Cervantes




PostPosted: Mon May 24, 2004 7:45 am   Post subject: (No subject)

go into turing, type "array", and press F9. read what it says, then make a simple program using an array. then come back here and see if you can understand what tony / supergenius recommend.
SuperGenius




PostPosted: Mon May 24, 2004 1:34 pm   Post subject: (No subject)

once again, i'll use code from my connect 4 to illustrate. there is a 2d array called board. when this proc is called it examines each value of the array to check if there is supposed to be a checker in the corresponding grid square, and then if there is supposed to be one it checks to see what colour it is supposed to be.

code:

proc drawboard
    for h : 1 .. 8
        for c : 1 .. 8
            if board (h, c) not= " " then
                if board (h, c) = "RED" then
                    Pic.Draw (redchecker, 107 + c * 60, 55 + h * 60, picMerge)
                elsif board (h, c) = "BLUE" then
                    Pic.Draw (bluechecker, 107 + c * 60, 55 + h * 60, picMerge)
                end if
            end if
        end for
    end for
end drawboard


so imagine the area of your game as a hypothetical grid, and you can impliment something like what i've shown you, except for bricks instead of checkers.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: