Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Block Stacker - A Block Stacking Game for Perl

by William G. Davis (Friar)
on Nov 01, 2004 at 00:29 UTC ( #404177=CUFP: print w/replies, xml ) Need Help??

(Updated, thanks to Pied and superfrink, and fixed the title thanks to mhi.) (Updated 11/11; much improved, see below for more.)
This needs a major overhall... Check back later.
  • Comment on Block Stacker - A Block Stacking Game for Perl

Replies are listed 'Best First'.
Re: Bock Stacker - A Block Stacking Game for Perl
by Pied (Monk) on Nov 01, 2004 at 02:45 UTC
    gives me an error:
    ./ unknown color name "SystemButtonFace" at /usr/local/lib/perl/5.8.4/Tk/ line 205. at lib/BlockStacker/ line 518
    Though I just updated my Tk from CPAN...

      I had the same problem (Perl 5.8.0 on slackware 9.1 with Tk just updated from CPAN). I just removed line 520 from lib/BlockStacker/ and the program ran fine. It did open up in a very small window way up in the top left corner of my screen so I had to resize and move it though. (By the way I'm using Fluxbox.)

      Also very neat game William G. Davis. I especially like how it looks like you had fun with the messages in the game and the extra odd shapes that I'm not used to dealing with in most tetris games. ++ indeed.

        Thanks guys. I removed the offending line from BlockStacker/ and uploaded a new version to SourceForge.

        As for the shrunk window, I think that's due to either using geometry("+0+0") to position the window but not specify its size, or the withdraw()/deiconify() + raise() combo used with it, or maybe both. Try commenting out those calls in createMainWindow() and runMainLoop() in and see if that helps.

Re: Block Stacker - A Block Stacking Game for Perl
by William G. Davis (Friar) on Nov 02, 2004 at 18:48 UTC

    New Version:

    • Increased stability. Starting a new game while the level is changing or the hammer is still on screen doesn't screw things up.
    • Images are now pooled instead of being constantly created over and over again. (See this node and this node by pg). Images are loaded once as Tk::Photo objects, then reused from then on with the new getImage() method.
    • Blocks displayed on the block preview canvas are now properly centered.
    • Changed the next level message.
    • Cleaned up the code more.

    I must say, this whole process was as easy as it was enjoyable. I would encourage anyone thinking of doing something similar to go ahead and do it.

Re: Block Stacker - A Block Stacking Game for Perl
by dpavlin (Friar) on Nov 06, 2004 at 20:11 UTC
    Good work! I'm still wondering should I upvote this node because of great game or downvote it because I lost allmost two hours after I started it for the first time :-)

Re: Block Stacker - A Block Stacking Game for Perl
by TilRMan (Friar) on Nov 11, 2004 at 07:41 UTC

    You are one sick and twisted puppy.


Re: Block Stacker - A Block Stacking Game for Perl
by William G. Davis (Friar) on Nov 11, 2004 at 23:16 UTC

    Added a high scores and a help window. Needs FreezeThaw now too. I also got rid of some memory leaks in it. (Some internal arrays in the GUI class were not getting cleared between levels properly.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://404177]
Approved by FoxtrotUniform
Front-paged by Jouke
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2018-06-22 00:30 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.