Permalink
Browse files

Added get_next_piece sub and fixed font orientation for tetris code

  • Loading branch information...
1 parent c7356aa commit 8744f560e240d65b40a75e566a81b2c47a04a5c5 @kthakore kthakore committed Jun 6, 2011
Showing with 345 additions and 307 deletions.
  1. +5 −3 code_listings/tetris.pl
  2. +340 −304 dist/SDL_Manual.html
  3. BIN dist/SDL_Manual.pdf
View
@@ -21,7 +21,7 @@
);
# create our game objects
-my $score_text = SDLx::Text->new( font => 'font.ttf', h_align => 'center', color => [255,255,255,255] );
+my $score_text = SDLx::Text->new( font => 'font.ttf', h_align => 'left', color => [255,255,255,255] );
my $score = 0;
my $back = SDLx::Surface->load( 'data/tetris_back.png' );
my @piece = (undef);
@@ -62,10 +62,12 @@
0,0,0,0],
);
-my $next_tile = shuffle(keys %pieces);
+my $next_tile = get_next_tile();
my $curr_tile = [undef, 4, 0];
@{$curr_tile->[0]} = @{$pieces{$next_tile}};
- $next_tile = shuffle(keys %pieces);
+ $next_tile = get_next_tile();
+
+sub get_next_tile { shuffle(keys %pieces) }
sub rotate_piece {
my $_piece = shift;
Oops, something went wrong.

0 comments on commit 8744f56

Please sign in to comment.