Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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
Re: Bock Stacker - A Block Stacking Game for Perl
by Pied (Monk) on Nov 01, 2004 at 02:45 UTC
    gives me an error:
    ./blockstacker.pl unknown color name "SystemButtonFace" at /usr/local/lib/perl/5.8.4/Tk/Widget.pm line 205. at lib/BlockStacker/GUI.pm line 518
    Though I just updated my Tk from CPAN...

    P!
      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/GUI.pm 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/GUI.pm 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 GUI.pm 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 :-)

    2share!2flame...
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://404177]
Approved by FoxtrotUniform
Front-paged by Jouke
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-12-21 16:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls