Computer Science Canada How To Constantly Check Values?! Help=20 Bits |
| Author: | Rasta Fella [ Thu Jan 19, 2006 7:09 pm ] | ||
| Post subject: | How To Constantly Check Values?! Help=20 Bits | ||
AHHH...Due Tommorow and I was Procrastinating the whole time. Ok, I made a dot so that when you press any arrow key and let go it will go in that direction forever untill another direction is pressed. Now the problem is I want to now constantly check the x,y cordinates while it moving across the page. Right now the problem is that it only checks the x,y values when you press that key...but I want it to check even if you are not pressing that key. The reason I need this is because I need whatdotcolour to "read" these values. Please help below is my source. I can't change much because we had to hand in psedocode to my teacher already. Below is Code:
Thanks In Advance... |
|||
| Author: | Drakain Zeil [ Thu Jan 19, 2006 8:38 pm ] |
| Post subject: | |
Why not just have it move once, check to see if it needs to stop, a new direction has happened, and then move it again in that direction? example: loop if (check if x+1 works) it does, then x+=1 end if if (new direction) then do the thinggs to change direction end if end loop |
|
| Author: | Tony [ Thu Jan 19, 2006 9:10 pm ] |
| Post subject: | |
to clarify what Drakain Zeil is saying, you should move your whatdotcolour outside of if chars() statements. |
|
| Author: | Rasta Fella [ Thu Jan 19, 2006 9:28 pm ] |
| Post subject: | |
Thanks Tony...my levels are procedures so can i put the whatdotcolour there? And if I understood properly your suggestions would still not fix my code. My problem for example that when you push the right key the dot moves and goes towards right but the x,y cordinates that were last registered by the computer were when you pushed the right arrow not while it is moving across the screen. I need help..this is due tommorow. |
|
| Author: | Clayton [ Tue Jan 24, 2006 2:25 am ] | ||
| Post subject: | |||
i know its a bit late but hopefully this would work
this will let you press the key once and it will continuously move until its reached as far as it can go and then it stops until you press another key sorry about it being late but now you know |
|||