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

Username:   Password: 
 RegisterRegister   
 I can't seem to get detection to work on my program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Varsteil




PostPosted: Fri Dec 23, 2011 8:29 am   Post subject: I can't seem to get detection to work on my program

What is it you are trying to achieve?
<When my character hits a black box, show an endgame splash screen (For now I am using cls to clear the screen just as a test)>


What is the problem you are having?
<Black bar just goes past box>


Describe what you have tried to solve this problem
<Moving the whatdotcolor, changing the color, using different results for the if statement>

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Attached>

Turing:


<Attached>



Please specify what version of Turing you are using
<4.1.1>



gamecollision.t
 Description:
This doesn't have my splash screen, I can add those on my own later on with a template

Download
 Filename:  gamecollision.t
 Filesize:  1.5 KB
 Downloaded:  47 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Fri Dec 23, 2011 5:57 pm   Post subject: Re: I can't seem to get detection to work on my program

First off, I see you're using processes. I suggest you read the documentation about Input.KeyDown and maybe hasch, they might make your life easier.

Onto the problem at hand.
Turing:
drawfillbox (0, y, 640, y1, black)
drawfillbox (x, y, x1, y1, white)
drawfillbox (boxx, boxy, boxx2, boxy2, blue)
if whatdotcolor (boxx2, boxy2) = black then

Can/is the pixel (boxx2, boxy2) ever black? If not then what is its colour? Try replacing your whatdotcolour check with
Turing:
locate (1,1)
put whatdotcolour (boxx2, boxy2)

the result should tell you what the problem is.

Let's also look at this code (I left out the unimportant parts):
Turing:
loop
getch (move)
if move = chr (203) then
elsif whatdotcolor (boxx2, boxy2) = black then
elsif move = chr (205) then
elsif whatdotcolor (boxx2, boxy2) = black then
end if

Since getch halts the process, the if statement will only execute immediately after a key press. This isn't exactly what you want. Also, if the first condition "move = chr (203)" is true, are the other conditions checked?

But the real problem is in the first piece of code I posted.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: