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

Username:   Password: 
 RegisterRegister   
 WALLS
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jedi-bob




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




PostPosted: Wed Jan 21, 2004 10:56 am   Post subject: (No subject)

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




PostPosted: Wed Jan 21, 2004 10:59 am   Post subject: (No 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.
Thuged_Out_G




PostPosted: Wed Jan 21, 2004 2:06 pm   Post subject: (No 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
Cervantes




PostPosted: Wed Jan 21, 2004 4:25 pm   Post subject: (No subject)

or without whatdotcolour...

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




PostPosted: Thu Jan 22, 2004 10:11 am   Post subject: (No 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.
Jedi-Jim




PostPosted: Thu Jan 22, 2004 10:38 am   Post subject: (No subject)

Hey there Jedi-bob its me Jedi-Jim
jedi-bob




PostPosted: Thu Jan 22, 2004 10:40 am   Post subject: (No subject)

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




PostPosted: Thu Jan 22, 2004 10:40 am   Post subject: (No subject)

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




PostPosted: Thu Jan 22, 2004 6:32 pm   Post subject: (No 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??
DanShadow




PostPosted: Thu Jan 22, 2004 10:51 pm   Post subject: (No 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!!
Cervantes




PostPosted: Fri Jan 23, 2004 2:31 pm   Post subject: (No subject)

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

Razz
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  [ 12 Posts ]
Jump to:   


Style:  
Search: