Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: "flashing"-like stuff

by Anonymous Monk
on Sep 24, 2011 at 16:18 UTC ( #927657=note: print w/replies, xml ) Need Help??

in reply to "flashing"-like stuff

here is an udated version, for better readability:
#!/usr/bin/perl $|=1; use Term::ReadKey; ReadMode 3; ($w, $h) = GetTerminalSize; #get size of the screen $x1 = 0; $y1 = 0; #ball start coordinates $dx = 0.05; $dy = 0.05; #increments to the ball coordinates $x = 0; #start position of the pad while (1) { $key = ReadKey -1; if ($key eq "d") {$x++; $x = $w-10 if $x > $w-10} #moving the pad to t +he right if ($key eq "a") {$x--; $x = 0 if $x < 0} #moving the pad to the l +eft print "\e[H"; print "\n" x ($h-2); print "\r\e[K"; print " " x $x; pri +nt "##########\r\e[H"; #drawing the pad at the bottom of the screen for (0..($h-3)) {print " " x ($w); print "\n"} #cleaning the screen ab +ove the pad print "\e[H\n\n\n"; print "\n" x $y1; print " " x $x1; print "O\r"; #d +rawing the ball $x1 += $dx; #update coordinates of the ball $y1 += $dy; $dx *= -1 if $x1 >= $w-1 || $x1 <= 0; #if the ball hits the left or ri +ght wall $dy *= -1 if $y1 <= 0 || ( $y1 >= $h-5 && $x1 > $x && $x1 < $x+10 ); # +if the ball hits the top wall or the pad if ($y1 > $h-4) {ReadMode 0; die "\nyou lose!\n"} #if the ball doesn't + hit the pad } ReadMode 0;
but the problem's still there, somewhere

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://927657]
[james28909]: how come it is so easy for me to not care what others think while others will mute themselves because they are scare they will be called ignorant or stupid
[james28909]: do you relize how shrodinger felt when he was describing the quantum world? what about neils bohr?
[holli]: it's probably the autist in you. I am like that too, no fucks given about what others think about me
james28909 checks, yep... htere are no fucks to give
[james28909]: another thing i am sick of is hurting others feelings
[1nickt]: james28909 You lost me a bit when you said "show me evolution from intelligence to ignorance". I guess we would have to define the terms, but as I look around at my species and how we are destroying our habitat ...
[james28909]: seems like a person cant even have a belief without hurting someones feelings. i never said my way is the only way. i just said i have pretty good scientific evidence, and then asked for opposing side to present evidence

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2017-12-15 14:26 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.