Computer Science Canada

WALLS

Author:  jedi-bob [ Wed Jan 21, 2004 10:54 am ]
Post subject:  WALLS

how can i make it so my player controlled cirlce cant go through walls?
I checked the collision detection tutorial, but the rectangle one was to hard to figure out (it was poorly explained), and the oval detection only says when they hit. now help out, theres some bits in it for you.

Author:  Andy [ Wed Jan 21, 2004 10:56 am ]
Post subject: 

use whatdotcolor and STOP POSTING STUPID QUESTIONS WITHOUT CONSULTING UR COMPSCI TEACHER AND THE TURING SOURCE/TUTORIAL SECTION

Author:  jedi-bob [ Wed Jan 21, 2004 10:59 am ]
Post subject: 

what the hell is whatdotcolor, and how would i use it for my walls, also maybe you missed it but i said i checked the tutorials and it was poorly explained.

Author:  Thuged_Out_G [ Wed Jan 21, 2004 2:06 pm ]
Post subject: 

whatdotcolor is used to check the color of a specified pixel.

use it like this

if whatdotcolor(x,y)=10 %where 10 would be the color of your box
then ballxdir:=-ballxdir
end if

all that does is, if the x and y coords of the ball hit the color 10, then reverse the direction of the ball

Author:  Cervantes [ Wed Jan 21, 2004 4:25 pm ]
Post subject: 

or without whatdotcolour...

code:
if ballxdir > maxx - 30 then
    ballxdir := -ballxdir
end if

Author:  jedi-bob [ Thu Jan 22, 2004 10:11 am ]
Post subject: 

i just want my ball not to go through the walls, not to bounce in a different direction (its not animated, it keyboard controlled) i just want it to stop, not bounce.

Author:  Jedi-Jim [ Thu Jan 22, 2004 10:38 am ]
Post subject: 

Hey there Jedi-bob its me Jedi-Jim

Author:  jedi-bob [ Thu Jan 22, 2004 10:40 am ]
Post subject: 

i haven't talked to you in along time, here have a bit.

Author:  Jedi-Jim [ Thu Jan 22, 2004 10:40 am ]
Post subject: 

don't worry BOB they can't prove the little girl was telling the truth

Author:  Cervantes [ Thu Jan 22, 2004 6:32 pm ]
Post subject: 

code:
if ballx > maxx - 30 then
    ballxdir := -0
end if



comon man with the info we gave you you could figure out how to do that...

unless...

do you know what ballxdir means??

Author:  DanShadow [ Thu Jan 22, 2004 10:51 pm ]
Post subject: 

hmm...
jedi bob wrote:

now help out, theres some bits in it for you.

That seems a lot like him trying to command us to help him....who would like to help someone who is commanding you to do something??? And you have barely any bits anyways, so bleh. Me, being the nice guy I am, will teach you the dark arts of the:
Twisted Evil"whatdotcolor"Twisted Evil
code:

var x, y, xmod : int := 200
xmod := 2
loop
    setscreen ("offscreenonly")
    View.Update
    Draw.FillBox (0, 0, maxx, maxy, 0)
    delay (2)
    Draw.FillBox (500, 150, 600, 250, black)
    Draw.FillOval (x, y, 20, 20, 12)
    x := x + xmod
    if whatdotcolor (x + 21, y) = black then
        xmod := 0
    end if
end loop

This code will move a ball, but when it hits the wall (which is black)...it stops. whatdotcolor is used like this
code:

whatdotcolor(x,y)=color
%(x,y)='x' and 'y' co-ordinate its checking what the dot color is at
%color= the color of dot its checking for
%soo.....
if whatdotcolor(x,y)=red then
put "AHH!! The whatdotcolor of x and y is red!!!"
end if

Understand??? Now ASK NICER next time!!

Author:  Cervantes [ Fri Jan 23, 2004 2:31 pm ]
Post subject: 

*does a jig around DanShadow*
Dan wants bits... Dan wants bits....

Razz


: