none
Side scrolling, man walking, development. Any ideas to get the graphic to stop blinking? RRS feed

  • Question

  • In developing a side scrolling game I have this issue with the little guy having this annoying blink as the program rotates through the graphics to create the animation. Any thoughts on how to clean this up a little? Import GHP746 to give it a try.

    Also, why does this work so slow on the web?

    Sunday, June 10, 2012 3:01 PM

Answers

All replies

  • I can improve the flicker a bit by the following:

      msFloor = Math.Floor(ms)
      If (mdlast <> md Or mslast <> msFloor) Then
        Shapes.ShowShape(man[md][msFloor])
        Shapes.HideShape(man[mdlast][mslast])
      EndIf
    

    1] Precalculate msFloor, so any delay in this calculation isn't important

    2] Only do the updates when something has changed

    3] Do the ShowShape before the HideShape

    The web SilverLight is just not going to be as efficient as a local exe.

    Sunday, June 10, 2012 3:21 PM
    Moderator
  • Thanks for the quick reply litedev. I tried your suggestions, they are very sound in concept but check out what happens.

    Import GHP746-0

    I did the precalc and I put the hide image after the show image, it made the flicker worse. Then tried the If, Then (uncomment lines 44 and 51, did not bother to check md yet, just mflast <> mf=floor(ms)) and the background goes backwards which makes no sense to me. Is this a small basic bug.


    Here's one that's smoother with the original flicker, GHP746-1
    • Edited by JKrueg Sunday, June 10, 2012 4:06 PM
    Sunday, June 10, 2012 3:58 PM
  • Here's the one I tested with, Import GHP746-2, using the suggested code.
    • Edited by litdevModerator Sunday, June 10, 2012 4:12 PM
    • Marked as answer by JKrueg Sunday, June 10, 2012 4:23 PM
    Sunday, June 10, 2012 4:11 PM
    Moderator
  • Wow, that is rock solid, I wonder why mine went so wrong? Thank You!
    Sunday, June 10, 2012 4:23 PM
  • Hi!

    Made some tweaks and pre-calcs. Dunno if it got any speedier.

    Nevertheless, here it is -> GHP746-3


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Sunday, June 10, 2012 5:08 PM
    Answerer
  • That does seem faster and definately works better running on a web page. I gotta get my head wrapped around this approach, and come up with a routine for jumping and an array of platforms to jump onto. TY.
    Sunday, June 10, 2012 9:05 PM