pictures dissapering

BlitzPlus Forums/BlitzPlus Beginners Area/pictures dissapering

ccowan59(Posted 2005) [#1]
this is my first game i'm making and i have it so that when you press right arrow a picture moves to the right.
but when I press the right arrow it just dissaperes

my code is:
Graphics 800,600

SetBuffer BackBuffer()

Global char=LoadImage ("char.png")
Global charx,chary

charx=0
chary=568
While Not KeyHit(1)

Cls
DrawImage char, charx,chary
While KeyDown(205)
charx=charx +1
Wend
Flip

Wend


CGV(Posted 2005) [#2]
The problem is you've misunderstood the use of while/wend.

Replace this:
While KeyDown(205)
charx=charx +1
Wend


with this:
If KeyDown(205) Then
charx=charx +1
Else If KeyDown(203) Then
charx=charx -1
EndIf


and that should solve your problem.

P.S. Post your code in code blocks in the future.
Forum codes are here clicky


ccowan59(Posted 2005) [#3]
Thank you so much and thanks for the tip too