Help for this page

Select Code to Download


  1. or download this
     $app->add_event_handler(sub {
            my $event= shift;
            if($event->type == SDL_KEYDOWN){
    ...
                }
            }
    });
    
  2. or download this
    
    use strict; 
    ...
        $ball->{v_x} = (4 + rand(2)) * (rand (2) > 1 ? 1 : -1);
        $ball->{v_y} = (1.5 + rand(1)) * (rand (2) > 1 ? 1 : -1);        
    }