Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
moving a sprite
#1
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
Reply
#2
I'll address this in your other thread.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
ok, thnx for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)