ok, I'm not talking about neon lights or something :P

I'm writing a small perl clone of PONG -- you know, the game everyone played at least once

this is the code so far:

#!/usr/bin/perl $|=1; use Term::ReadKey; ($w, $h) = GetTerminalSize; ReadMode 3; $x1 = 3; $y1 = 3; $dx = 0.05; $dy = 0.05; print "\e[H"; print "\n" x ($h-2); print " " x ($w/2-5); print "##########\r"; $x=($w/2-5); while (1) { $key = ReadKey -1; if ($key eq "d") {$x++; if ($x>($w-10)) {$x=($w-10)}; print "\e[H"; print "\n" x ($h-2); print "\r"; pri +nt "\e[K"; print " " x $x; print "##########\r";} if ($key eq "a") {$x--; if ($x<0) {$x=0}; print "\e[H"; print "\n" x ($h-2); print "\r"; pri +nt "\e[K"; print " " x $x; print "##########\r"; } print "\e[H"; for (0..($h-3)) {print " " x ($w); print "\n"} print "\e[H\n\n\n"; print "\n" x $y1; print "\r\e[K"; print " " x $x1; + print "O\r"; $x1 = ($x1 + $dx); $y1 = ($y1 + $dy); if ( ($y1)>=($h-5) || $y1<=0) {$dy *= -1} if ( ($x1)>=($w-1) || $x1<=0) {$dx *= -1} } ReadMode 0;

yes - there isn't any "my" or strict or warnigns... but that's not the problem. and yes - the ball bounce in its own way, don't caring about the pad

before go ahead, I've got this problem, when you run that code, the cursor of the ball made everything "flashing" and make the game annoying

how can I avoid this annoying flashing ?

(sorry for my bad english)


In reply to "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.