I can't seem to get detection to work on my program
Author |
Message |
Varsteil
![](http://compsci.ca/v3/uploads/user_avatars/15841261014e8660898a30b.jpg)
|
Posted: 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>
Please specify what version of Turing you are using
<4.1.1>
Description: |
This doesn't have my splash screen, I can add those on my own later on with a template |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
gamecollision.t |
Filesize: |
1.5 KB |
Downloaded: |
47 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dreadnought
|
Posted: 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
the result should tell you what the problem is.
Let's also look at this code (I left out the unimportant parts):
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.
|
|
|
|
|
![](images/spacer.gif) |
|
|