
-----------------------------------
harishmabish
Thu Apr 03, 2008 4:56 pm

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?!

-----------------------------------
Tony
Thu Apr 03, 2008 5:00 pm

RE:Input.KeyDown trouble
-----------------------------------
why would

var carx, cary : int 
carx := 350 
cary := 250

be inside a loop?

-----------------------------------
that-guy
Thu Apr 03, 2008 5:08 pm

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

-----------------------------------
harishmabish
Fri Apr 04, 2008 5:28 pm

RE:Input.KeyDown trouble
-----------------------------------
thanks for the tips

-----------------------------------
Nick
Fri Apr 04, 2008 6:35 pm

RE:Input.KeyDown trouble
-----------------------------------

Input.KeyDown (chars)
if chars1 (KEY_UP_ARROW) then 

notice how chars1 isn't the same as chars
