I think that I am reading your code correctly, if not, then ignore as appropriate.

When you are printing your movement, you are first clearing the old location, then writing to the new location. There is a period of time where the screen does not have the "sprite" displayed. With graphics-based sprites, I believe that the correct solution is to xor at the new location, then xor at the old location. In your text based version, print to the new location first, then clear the old location. There may be some edge cases <update>especially when old and new overlap</update> that you need to consider.

It has been a number of years since I have tackled this problem, but I seem to remember it being a common one when moving blocks of stuff around the screen.

--MidLifeXis


In reply to Re: "flashing"-like stuff by MidLifeXis
in thread "flashing"-like stuff by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.