locked
Reduce Screen Flashing RRS feed

  • Question

  • Hi everyone,

    I am trying to make a simple game, I have a image on the screen and would like to use the arrow keys to move the image how can I do this without the screen flashing?

    This is due to me having to clear the screen when the keydown event is happening to update the images position.

    I think I read a similar post awhile ago but can't seem to find it now.

    Thanks.

    Monday, March 7, 2011 10:13 AM

Answers

  • Why do you clear screen? Are you using GraphicsWindow.DrawImage()? If you are, use movable Shapes (No more clearing):

    image = ImageList.LoadImage("Your image")
    image = Shapes.AddImage(image)'create image shape
    Shapes.Move(image,yourStartingX,yourStartingY)'move image to starting position
    GraphicsWindow.KeyDown = OnKeyDown

    Sub OnKeyDown
      'Put your code to get new x and y for image
      Shapes.Move(image,yourNewX,yourNewY)'update image position without flash
    EndSub

     


    Sorry My Bad English
    • Marked as answer by Kirkkaf Monday, March 7, 2011 12:15 PM
    Monday, March 7, 2011 11:57 AM

All replies

  • Why do you clear screen? Are you using GraphicsWindow.DrawImage()? If you are, use movable Shapes (No more clearing):

    image = ImageList.LoadImage("Your image")
    image = Shapes.AddImage(image)'create image shape
    Shapes.Move(image,yourStartingX,yourStartingY)'move image to starting position
    GraphicsWindow.KeyDown = OnKeyDown

    Sub OnKeyDown
      'Put your code to get new x and y for image
      Shapes.Move(image,yourNewX,yourNewY)'update image position without flash
    EndSub

     


    Sorry My Bad English
    • Marked as answer by Kirkkaf Monday, March 7, 2011 12:15 PM
    Monday, March 7, 2011 11:57 AM
  • Thanks alot Oskariok this is just what I wanted. I didn't know you could add the image as a shape.
    Monday, March 7, 2011 12:15 PM