Computer Science Canada whatdotcolour Problem |
Author: | bharath1000 [ Mon Dec 24, 2012 11:15 pm ] | ||
Post subject: | whatdotcolour Problem | ||
I'm trying to use the whatdotcolour command and it is not working for me (Note: first time using this command) and i dont see what is wrong with what i did... im trying to make the character stop when it hits the white block
Please specify what version of Turing you are using Turing 4.1.1 |
Author: | Insectoid [ Tue Dec 25, 2012 4:45 am ] | ||
Post subject: | RE:whatdotcolour Problem | ||
Where is this point? Why do you check again if the left/right arrow keys are pressed before subtracting the velocity? You're only checking if a 1-pixel-thick line at the top of Hossam's head and twice his width is hitting the brick. Can you figure out why? |
Author: | bharath1000 [ Tue Dec 25, 2012 1:36 pm ] | ||
Post subject: | Re: whatdotcolour Problem | ||
Thank you.. i got it too work but now there is another problem.... the character sinks through the ground every time he jumps from a certain height . is there any way to fix??
|
Author: | Insectoid [ Tue Dec 25, 2012 1:47 pm ] | ||
Post subject: | RE:whatdotcolour Problem | ||
If the character is below the ground, what can you do to put him on the ground again? Also:
You can reduce this part to one line. |
Author: | bharath1000 [ Tue Dec 25, 2012 2:13 pm ] |
Post subject: | RE:whatdotcolour Problem |
there is a ground height and it works but eveytime i jump i land a few units below the ground and float back up to the ground height again |
Author: | Insectoid [ Wed Dec 26, 2012 11:20 am ] | ||
Post subject: | RE:whatdotcolour Problem | ||
You do not have a ground height. You have a boolean called ground height, but that does not represent the height of the ground. Ground height should be an integer, and if your character's y value is lower than that integer, you are underground.
What is this code doing? You check if the character is underground, then you set vely to gravity (vely := 0, vely += gravity is equivalent to vely := gravity). Gravity is a positive value (5). Then you add vely (gravity) to y. So if your character is underground, he will float up at 5 pixels per second. This issue is not easily solved with whatdotcolor. Not as easily as regular collision detection anyway. Actually, whatdotcolor is pretty bad overall. It will take a lot of work to switch over to a better system, but once you've done that everything becomes a lot easier. |
Author: | bharath1000 [ Wed Dec 26, 2012 3:30 pm ] |
Post subject: | RE:whatdotcolour Problem |
Can you explain what the better system is? or at least the idea of it? |
Author: | Insectoid [ Wed Dec 26, 2012 3:44 pm ] |
Post subject: | RE:whatdotcolour Problem |
I could, but the Turing Walkthrough already did. |
Author: | Raknarg [ Wed Dec 26, 2012 9:25 pm ] |
Post subject: | RE:whatdotcolour Problem |
I think he's referring to using actual objects for detection rather than colour. So instead of landing on a colour, you land on top of the range of an object. It makes it much more flexible, and you don't have to keep using the same colour. |
Author: | Insectoid [ Thu Dec 27, 2012 10:53 am ] |
Post subject: | RE:whatdotcolour Problem |
Actually, whatdotcolor doesn't limit your pallet at all. Using View.Update, you draw your simple colors, do all your detection work, then draw the real image on top, then update the screen. |
Author: | Raknarg [ Thu Dec 27, 2012 12:12 pm ] |
Post subject: | RE:whatdotcolour Problem |
So it reads the buffer, not the screen itself? I didn't know that |