Computer Science Canada Input.KeyDown trouble |
Author: | harishmabish [ Thu Apr 03, 2008 4:56 pm ] |
Post subject: | Input.KeyDown trouble |
var carx, cary : int carx := 350 cary := 250 Input.KeyDown (chars) if chars1 (KEY_UP_ARROW) then cary:=cary -10 end if Pic.Draw (car1, carx, cary, picMerge) delay (10) View.Update cls That's a part of my code, when i press the up arrow, the object will move 10 pixels down the y axis, but when i let go of the button, it goes right back to its normal spot. What's goin on here? am i missing something? it should stay 10 mp down?! |
Author: | Tony [ Thu Apr 03, 2008 5:00 pm ] | ||
Post subject: | RE:Input.KeyDown trouble | ||
why would
be inside a loop? |
Author: | that-guy [ Thu Apr 03, 2008 5:08 pm ] |
Post subject: | Re: Input.KeyDown trouble |
Make sure you are declaring and assigning your variables outside the loop. Also, when you tell it to move down 10 pixels, just say: cary -= 10 instead of: cary := cary - 10 |
Author: | harishmabish [ Fri Apr 04, 2008 5:28 pm ] |
Post subject: | RE:Input.KeyDown trouble |
thanks for the tips |
Author: | Nick [ Fri Apr 04, 2008 6:35 pm ] |
Post subject: | RE:Input.KeyDown trouble |
Quote: Input.KeyDown (chars) if chars1 (KEY_UP_ARROW) then notice how chars1 isn't the same as chars |