Permalink
Browse files

It scrolls bitches

  • Loading branch information...
1 parent 95d4c89 commit aa361ecec99d838002a8e3c1664f8468eacf6846 @kthakore committed Aug 19, 2010
Showing with 27 additions and 2 deletions.
  1. +27 −2 scroller.pl
View
@@ -36,8 +36,7 @@
my $jumping = -1;
my $jump_count = 20;
my $print = '';
-
-
+my $scroller = 0;
$obj->set_acceleration(
@@ -97,6 +96,32 @@
# $print = " $move | $moving ";
$move = 'none';
+
+
+ if( $scroller )
+ {
+ my $dir = 0;
+ $scroller-- and $dir = +1 if $scroller > 0;
+ $scroller++ and $dir = -1 if $scroller < 0;
+
+ $state->x( $state->x() + $dir );
+
+ $_->[0] += $dir foreach( @collide_blocks );
+
+ }
+ else
+ {
+ if ( $state->x() > $app->w - 25 )
+ {
+ $scroller = -5;
+ }
+ if ( $state->x() < 25 )
+ {
+ $scroller = 5;
+ }
+
+
+ }
return ( 0, $ay, 0 );
}
);

0 comments on commit aa361ec

Please sign in to comment.