
-----------------------------------
juniorspank
Tue Nov 25, 2003 4:41 pm

Anyone have a good working Pong game?
-----------------------------------
I was just wondering because I've been looking for one.  That or Light Cycles. :hb:

-----------------------------------
Andy
Tue Nov 25, 2003 4:47 pm


-----------------------------------
http://www.compsci.ca/v2/viewtopic.php?t=914

my pong, only exe tho

-----------------------------------
juniorspank
Tue Nov 25, 2003 4:52 pm

Thanks
-----------------------------------
Thanks, it is very much appreciated.

-----------------------------------
roer
Tue Nov 25, 2003 6:24 pm


-----------------------------------
Dodge I'm in the process in making a pong game myself but I don't know how to make Turing recognize the Draw.Box as function of some sort so I can call on it. I've been studying Turing for about a week now and I don't really want an answer, just a hint of somesort. Thanks

-----------------------------------
AsianSensation
Tue Nov 25, 2003 7:28 pm


-----------------------------------
lol, get your turing updated, go to holtsoft and download their patch, this will have that problem fixed.

If you don't want to or can't download for some reason, use drawbox () instead.

-----------------------------------
roer
Tue Nov 25, 2003 7:33 pm


-----------------------------------
I know how to draw the box, I have v4.0.4 at school. I was just wondering once you draw the box, how do you call on it later? If I draw the box how do I declare it? Sorry if it seems like a really newbish question  :oops:

-----------------------------------
Tony
Tue Nov 25, 2003 7:38 pm


-----------------------------------
oh, lol. Box is not an object, its just a graphic that is put on the screen. You can't do anything with it, but to draw something over it to make the box disappear :lol:

sorry to break this to you - but Turing sucks when it comes to programming.

-----------------------------------
roer
Tue Nov 25, 2003 7:41 pm


-----------------------------------
Yes...I have heard that Turing isnt exatcly a complex language, from what Catalyst and Home do however Im kind of in shock of what they do with Turing. So, can I ask then how to make Turing draw a box so that I can put in my code that would allow it to move?

    Pic.Draw (leftpaddlepic, x, y, picMerge)
    Input.KeyDown (direction)
    if direction (KEY_CTRL) then
        y := y + 5
    elsif direction (KEY_ALT) then
        y := y - 5
    end if

Right now thats what I have for the movement of the paddles, I have a paddle I drew in paint earlier put in there. I was just wondering how to replace the paddle I drew in paint, with one Turing makes itself.

-----------------------------------
Tony
Tue Nov 25, 2003 7:48 pm


-----------------------------------
what you do is just redraw the entire screen on top of existing one, this time with paddle moved.

You might want to read up some info on the use of View.Update if you dont want flicker in your animation.

-----------------------------------
roer
Tue Nov 25, 2003 7:50 pm


-----------------------------------
Thanks tony   :) I'm going to read a bit more about Turing and hope that class teaches me something , my teachers really intresting and informative unlike others I've had

-----------------------------------
Andy
Tue Nov 25, 2003 8:03 pm


-----------------------------------
have you guys done procedures yet?

-----------------------------------
roer
Tue Nov 25, 2003 8:04 pm


-----------------------------------
No we havent but I understand the basics of them, do you mind explaining how to link procedures to this because when I tried it came up with an error  :oops:

The debug message was:

procedures may only be declared at the program,module, or monitor level

-----------------------------------
Andy
Tue Nov 25, 2003 8:06 pm


-----------------------------------
i'd have the whole thing done in procedures.
have a procedure that draw the stuff, and a procedure for movement.

-----------------------------------
Tony
Tue Nov 25, 2003 8:06 pm


-----------------------------------
a good idea would be to read a tutorial on [url=http://www.compsci.ca/v2/viewtopic.php?p=1903]procedures and such

-----------------------------------
AsianSensation
Tue Nov 25, 2003 8:18 pm


-----------------------------------
if you tried to declare a procedure in another procedure, then you would get that error.

-----------------------------------
roer
Tue Nov 25, 2003 8:53 pm


-----------------------------------
var x, y : int := 1
var direction : array char of boolean

procedure leftpaddle
    loop
        Draw.Box (x, y, 100, 100, green)
        Input.KeyDown (direction)
        if direction (KEY_UP_ARROW) then
            y := y + 10
        elsif direction (KEY_DOWN_ARROW) then
            y := y - 10
        end if
        View.Update
        delay (10)
        cls
    end loop
end leftpaddle

leftpaddle


Well, thats what I got with the procedure code so far. The box however is really something, when you press Up or Down the box simply grows. The bottom of the box stays the same however, anyone have any suggestions?

-----------------------------------
Andy
Tue Nov 25, 2003 9:13 pm


-----------------------------------
your drawing the box from y to 100, you should do from y to y+100 in your draw box thing. o and for collision detection, use whatdotcolor!

-----------------------------------
roer
Tue Nov 25, 2003 9:17 pm


-----------------------------------
Lol dodge I heard you know a lot about whatdotcolour  :) Care to give me link or short explaination of its function?

-----------------------------------
Andy
Tue Nov 25, 2003 9:22 pm


-----------------------------------
hey! great idea! tutorial on whatdotcolor! ok i'll give you the short version 1st
whatdotcolor(x,y) gives you an integer which is the color of the pixel at coordinates x,y. for a simple game like pong, your paddle is prolly gonna be all white, so you can simply go around the ball and see if it touches any white ie

for i:-radius..radius
    for j:-radius.. radius
        if i^2+j^2=radius^2 and whatdotcolor(i,j)=white then
            %bounce ball back
        end if
    end for
end for


that will check if the ball had touched any white anywhere.
then basicly, if the ball touches, just switch directions

-----------------------------------
roer
Tue Nov 25, 2003 9:28 pm


-----------------------------------
whatdotcolour seems to be very practical, is it efficent though? Even if it isn't, it gets the job done it seems  :) thanks for your explaination dodge, i'll use whatdotcolour in my game when I finish it  :)

-----------------------------------
Andy
Tue Nov 25, 2003 9:32 pm


-----------------------------------
gj my young padawan ha tony take that! :P
the only thing wrong wtih whatdotcolor is that it is not exactly the most function thing invented... other than that, its very useful... but oh well, in a couple of years, we'll all be runing comps with clock speeds of a couple yodahurtz so who cares about efficency... 
i'm gonna invent a language based on whatdotcolor!

-----------------------------------
roer
Tue Nov 25, 2003 9:36 pm


-----------------------------------
Lol, tony dosen't seem to agree with you on the whatdotcolour topic  :roll: Good luck with that language by the way  :wink:

-----------------------------------
Mazer
Tue Nov 25, 2003 9:43 pm


-----------------------------------
i'm gonna invent a language based on whatdotcolor!

heck yeah! it'll replace turing as the most taught language in canadian highschools. and then, some kid who sucks at math but excels in compsci will become the greatest in his class and be destined to write the whatdotcolor version of evasive maneuvers.

-----------------------------------
roer
Tue Nov 25, 2003 9:59 pm


-----------------------------------
One more question....when using procedures how do you display multiple procedures at once? For example, I'm trying to make both of my paddles appear at once using procedures, but it only displays one on the screen. Is there a function that enables both procedures to be operational at the same time?

View.Set ("graphics")
var x, y, x1, y1 : int
var direction, direction1 : array char of boolean
x := 10
y := 10
x1 := 580
y1 := 180
procedure leftpaddle
    loop
        Draw.FillBox (x, y, x + 30, y + 120, green)
        Input.KeyDown (direction)
        if direction (KEY_CTRL) then
            y := y + 10
        elsif direction (KEY_ALT) then
            y := y - 10
        end if
        View.Update
        delay (50)
        cls
    end loop
end leftpaddle

procedure rightpaddle
    loop
        Draw.FillBox (x1, y1, x1 + 30, y1 + 120, blue)
        Input.KeyDown (direction1)
        if direction1 (KEY_UP_ARROW) then
            y := y + 10
        elsif direction1 (KEY_DOWN_ARROW) then
            y := y - 10
        end if
        View.Update
        delay (50)
        cls
    end loop
end rightpaddle

leftpaddle
rightpaddle

Here's the code so far, simple indeed  :)

-----------------------------------
Andy
Tue Nov 25, 2003 10:00 pm


-----------------------------------
dont have a loop inside the procedure, run both procs in side a loop in your mainline

-----------------------------------
roer
Tue Nov 25, 2003 10:59 pm


-----------------------------------
Oooooo...I should pay more attention to things like that  :oops: Just finished watching 24  :) That was an awesome episode BTW  :wink:

-----------------------------------
Tony
Tue Nov 25, 2003 11:19 pm


-----------------------------------
i'll use whatdotcolour in my game when I finish it  :)

that's what happens when I step away from the computer to play some GTA3 :roll:

-----------------------------------
roer
Tue Nov 25, 2003 11:24 pm


-----------------------------------
i'll use whatdotcolour in my game when I finish it  :)

that's what happens when I step away from the computer to play some GTA3 :roll: :oops: Actually I'm still at debate with myself as to use it or not...your not to late yet  :wink:

-----------------------------------
Tony
Tue Nov 25, 2003 11:42 pm


-----------------------------------
dont use the evil!

I'll give you bits :lol:

-----------------------------------
roer
Wed Nov 26, 2003 12:13 am


-----------------------------------
Lol, bribing me with bits  :wink: Heh, I'm not using whatdotcolour in my current version of pong...but who knows what the future may holy  :wink:

-----------------------------------
Andy
Wed Nov 26, 2003 1:12 pm


-----------------------------------
tony i got a deal for you... heh... you can pay me 100 bits perday to stop corrupting the youngers of compsci.ca with my whatdotcolor... how about it?

-----------------------------------
Tony
Wed Nov 26, 2003 5:14 pm


-----------------------------------
how about you pay me 50 bits a day (you make way over that will all your spamming) and I dont just take all of them from you with a click of a button? :twisted:

-----------------------------------
roer
Wed Nov 26, 2003 5:31 pm


-----------------------------------
Man..I really caused more strife  :wink:

-----------------------------------
thoughtful
Wed Nov 26, 2003 6:44 pm


-----------------------------------
lol they do that all the time, dodge and tony, its the battle for programming superiority :twisted:  :twisted:  :twisted: . hmm..by the way if you ever get tired of all those bits, i can always take care of em for you  :wink:  :wink:

-----------------------------------
Andy
Thu Nov 27, 2003 12:01 pm


-----------------------------------
lol, yea sry about that.. i just need 2500 bits... i'll stop spamming after that. or you could just give me the rest so i dont have to spam for them

-----------------------------------
Dan
Thu Nov 27, 2003 3:59 pm


-----------------------------------
Ok this topic has got way of topic.

*Locked*
