Results 1 to 10 of 10

Thread: moving picture

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Ontario, Canada
    Posts
    12

    moving picture

    Hi, im working on a simple program for my computer sciences class.

    im making a side scroller, and the problem is that when the background moves to the left it blinks; there are flashes of grey that show up sparatically.

    any help is much appreciated!

  2. #2
    Junior Member
    Join Date
    Nov 2002
    Posts
    18
    What method are you using to animate it? Are you using BitBlt? DirectX? Or are you using Picturebox controls? Or something else?

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Ontario, Canada
    Posts
    12
    I have two pictureboxes that move across the screen using a timer. once one picturebox is off the screen it goes back to the right side.

    Would it be better if i just made one really long image instead of looping it?

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I'm not sure if it will help, but try to set the pictureboxs autoredraw property to true....if that don't help, then I'm not sure if you can take away the flickering using a picturebox..

  5. #5
    Junior Member
    Join Date
    Nov 2002
    Posts
    16
    Hey..

    I too am in a computer science class and am making a 2d side scrolling game! My advice is not to use timer's in your game and to create a game loop.

    I will upload an example tommorow that may help you. My game is having the backgound scroll (not the actual sprite) and I too am having some troubles.

    But to get rid of you flashes..try making a back buffer. The best way is if you can upload what you have and I'll take a look at it.

    Doe

  6. #6
    Junior Member
    Join Date
    Nov 2002
    Posts
    16
    I know I said I would upload my example but I was fooling around with it and I have messed it up

    I will continue to work on it and upload it as soon as I can

    Doe

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Ontario, Canada
    Posts
    12
    Hey thanks a lot man!

    if you want to see what i have its uploaded
    Here

    Just another question.

    When you hold down an arrow key i want an immediate response from the program.
    Right now because you have to hold down the arrow keys for a bit before the computer rapidly presses the button it makes it hard to move the ship.

    does anyone know how to fix this?

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    You are probably using the KeyPress event....if you declare a boolean...and assain itto true in the keydown event and false in the keyup event, then you don't have that problem anymore...but then you would have to find an other method to call your function....

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    This is how to do it....do as I said above, but domit with a long in stead...assign it 0, in the keydown event check if the user presses down or up....if up then assign that long the value 1, if down assign it 2. Then in your main loop check the long. If it zero, then make it go stright forward, if it is 1 then make it go up, if it is 2 then make it go down....

    Good luck...nice game...I had a look at it...

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Location
    Ontario, Canada
    Posts
    12
    wow thanks a lot
    it works perfectly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width