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

Re: pong paddles are not going equally fast

by bliako (Monsignor)
on Jul 23, 2020 at 08:10 UTC ( [id://11119700]=note: print w/replies, xml ) Need Help??


in reply to pong paddles are not going equally fast

New paddle position also depends on $step which is the time slice.

When you press UP-arrow this checks only the 1st condition. When you press DOWN-arrow it checks both conditions. Could that be affecting $step? Ideally no but try print $step and see.

if($event-> key_sym == SDLK_UP){ $player1->{v_y} = -2; } elsif($event->key_sym == SDLK_DOWN){ + $player1->{v_y} = 2; }

bw, bliako

Replies are listed 'Best First'.
Re^2: pong paddles are not going equally fast
by choroba (Cardinal) on Jul 23, 2020 at 08:23 UTC
    > Could that be affecting $step?

    Can be easily tested by swapping the conditions.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119700]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found