Qbasicnews.com

Full Version: moving a sprite
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
wat im trying to do is expand on a tutorial bu makin it so u can move a ball around the screen, but im not worrying about limits rite now, not everytime i go to run, it givs me the end msg, heres the code

Code:
SCREEN 13
  CLS
  ' Draw a filled circle for our sprite
  CIRCLE (4, 3), 4, 4
  PAINT (4, 3), 12, 4

  ' Set aside enough space to hold the sprite
  DIM Ball%(37)

  ' Clear the screen
  CLS

  ' Get the sprite into the Ball% array
  GET (0, 0)-(8, 7), Ball%

  ' Display the sprite elsewhere on the screen
  PUT (160, 100), Ball%

  ' Set default x and y coordiantes
  x = 160
  y = 100

  ' Allow user input
  WHILE INKEY$ = CHR$(71)
  CLS
  x = x - 1
  y = y + 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(72)
  CLS
  y = y + 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(73)
  CLS
  x = x + 1
  y = y + 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(75)
  CLS
  x = x - 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(76)
  CLS
  x = 160
  y = 100
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(77)
  CLS
  x = x + 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(79)
  CLS
  x = x - 1
  y = y - 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(80)
  CLS
  y = y - 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  WHILE INKEY$ = CHR$(82)
  CLS
  x = x + 1
  y = y - 1
  PUT (x, y), Ball%
  SLEEP .5
  WEND

  ' No button being pressed
  WHILE INKEY$ = ""
  PUT (x, y), Ball%
  WEND

  ' Allow quiting
  IF INKEY$ = CHR$(27) THEN END

can anyone help me fix this
I'll address this in your other thread.
ok, thnx for the help