Game Development Community

Bubble Breaker - TGB Modification Source Code release!

by Aun Taraseina · in Torque Game Builder · 02/13/2011 (6:07 am) · 14 replies

www.mayansoftware.com/bubblebreaker/image/mayanlogo128_128.png

TGB modifications made for Bubble Breaker : Insanely Addictive!

As promise from my last blog about releasing TGB source code modifications I made for Bubble Breaker : Insanely Addictive!, here it is.

Files Included in the Archive

www.mayansoftware.com/bubblebreaker/image/fileList.jpg





























What feature is added when you use this source code with your TGB source

  • Support for Mac AppStore including receipt validation and file storaging to compile with Apple Guide line
  • Support for Intel AppUp client validation
  • Bug fixes for the Mac Platform
  • Bug fixes for the Window Platform
  • Sound Pausing and Resuming
  • Source Rect Support for Both Gui and t2dStaticSprite
  • Source Rect Bug fixes
  • Auto Scrolling Gui (helpful for things like Game Credit)
  • Animated GUI including Alpha animation, Moving Gui and Scaling Gui

How to merge this code with your TGB source


  1. Back up your work!
  2. Include mEase.cc and mEase.h to both your TGBGame and TorqueGameBuilder Project
  3. Merge this code to your TGB code base, you can use merging tools such as Beyond Compare or Ultra Edit.
  4. That's it, it should work with your original project without any problems.

Using the new source code

  • To Submit your game to the Mac AppStore(all the code from the tutorial is already included here)
  • To Submit your game to the Intel AppUp Store(all the code from the tutorial is already included here)
  • To Pause or Resume every sound that is being played, you can use
  • alxPauseAll(); // Pause all the sounds
    alxUnpauseAll(); // Resume all the sounds
  • Using Source Rect - The term source rect is where we us a rectangle of a sprite sheet to represent the image of a GUI or t2dStaticSprite. You can use a tool name "UnChaos" included with TGB to group many small images to a large sprite sheet. This code add this feature to the GUI so you can add source rect to them
  • Here's an example of using source rect with "GuiBitmapButtonCtrl"
    new GuiBitmapButtonCtrl() {
             canSaveDynamicFields = "0";
             isContainer = "1";
             Profile = "GuiButtonDefaultProfile";
             HorizSizing = "relative";
             VertSizing = "relative";
             Position = "45 85";
             Extent = "140 92";
             MinExtent = "8 2";
             canSave = "1";
             Visible = "1";
             color = "255 255 255 255";
             unitClip = "0 0 1 1";
             hovertime = "1000";
             groupNum = "-1";
             buttonType = "PushButton";
             useMouseEvents = "0";
             bitmap = "~/data/images/spritesheet.png";
    
             useSourceRect = "1"; // Use Source Rect
             sourceRectNormal = $SR_BUTTON_N; //$SR_BUTTON_N = "100 100 128 128";
             sourceRectHilight = $SR_BUTTON_H; //$SR_BUTTON_H = "100 100 128 128";
             sourceRectDepressed = $SR_BUTTON_D; //$SR_BUTTON_D = "100 100 128 128";
             sourceRectInactive = $SR_BUTTON_I; //$SR_BUTTON_I = "100 100 128 128";
        };

    Here's another example of using Source rect with an "GuiBitmapCtrl"
    new GuiBitmapCtrl() {
                canSaveDynamicFields = "0";
                isContainer = "0";
                Profile = "GuiDefaultProfile";
                HorizSizing = "relative";
                VertSizing = "relative";
                Position = "20 9";
                Extent = "27 71";
                MinExtent = "8 2";
                canSave = "1";
                Visible = "1";
                alpha = "1";
                color = "255 255 255 255";
                unitClip = "0 0 1 1";
                hovertime = "1000";
                bitmap = "~/data/images/spritesheet.png";
                wrap = "0";
                useSourceRect = "1";
                sourceRect = $SR_GAMESCREEN_BG;
             };
  • Here's a sample of using "GuiAutoScrollCtrl" to display your credit
  • new GuiAutoScrollCtrl(CreditTextScroll) {
          canSaveDynamicFields = "0";
          isContainer = "1";
          Profile = "GuiDefaultProfile";
          HorizSizing = "relative";
          VertSizing = "relative";
          Position = "345 165";
          Extent = "349 200";
          MinExtent = "8 2";
          canSave = "1";
          Visible = "1";
          hovertime = "1000";
          childMargin = "0 0";
          enableScrolling = "1";
          horizontalScroll = "0";
          horizontalScrollDirection = "left";
          verticalScroll = "1";
          verticalScrollDirection = "up";
          scrollInterval = "20";
          scrollDelta = "1";
          repeatScroll = "1";
          new GuiMLTextCtrl(Credits_Text) {
             canSaveDynamicFields = "0";
             isContainer = "0";
             Profile = "GuiMLTextProfile";
             HorizSizing = "relative";
             VertSizing = "relative";
             Position = "0 -28";
             Extent = "349 100";
             MinExtent = "137 100";
             canSave = "1";
             Visible = "1";
             hovertime = "1000";
             lineSpacing = "100";
             allowColorChars = "0";
             maxChars = "4500";
             text = "<just:center>" @ "My rolling Credit\n I am the developer of this game \n Isn't that awesome";
          };
       };
  • The other new features is the ability to fade in and out your Guis. As you can see to the list of changes, I added alpha fading to almost every gui. Here's an sample of how you can fade a Gui
  • MyAlphaAnimatedGui.animateAlpha(1, 0, 250); //animate alpha to 255 with in 250 miliseconds
    MyAlphaAnimatedGui.animateAlpha(0, 0, 250); //animate alpha to 0 with in 250 miliseconds

    About Bubble Breaker : Insanely Addictive!

    Bubble Breaker is an award winning game which is currently being featured New and Noteworthy by Apple. The game is also ranked in Top 60 overall(US and many more countries) in the Mac AppStore. You can get the game from

    mayansoftware.com/bubblebreaker/image/gameband_mac.png mayansoftware.com/bubblebreaker/image/gameband.png

    Special Thank you

    About the author

    COO for Kiragames, developer of Unblock Me. With over 60 million downloads and named #17 most download Application of all time. My work is to extend our IP to higher ground and find ways we can work with other awesome companies.


    #1
    02/13/2011 (6:37 am)
    Awesomeness! I just bought the game, so this is a nice bonus :)
    #2
    02/13/2011 (9:23 am)
    Thanks Ronny :D
    #3
    02/13/2011 (9:33 am)
    I agree... very awesome! Thanks a ton for all your effort in getting the two stores figured out, too! You'll save me a lot of work.
    #4
    02/15/2011 (10:39 am)
    Thanks Aun!!!

    Much appreciated, I will give it a blast, but I never have much luck with compiling the T2D source on my Mac :D
    #5
    02/15/2011 (11:27 am)
    @Gavin: If you are having problems after following Aun's tutorial, I want to know how you broke your system so badly, and if it's possible to get a restraining order against you on behalf of all Macs ;)

    Seriously, it's a perfect checklist for getting T2D built.
    #6
    02/15/2011 (12:22 pm)
    @Ronny, think you better file for the restraining order now ;)
    #7
    02/16/2011 (3:02 pm)
    Hi Aun,

    Just a quick one for you, it may or may not be me, but using:

    #ifdef TORQUE_TOOLS
    #define OSX_MENUBAR_OFFSET 90
    #else
    #define OSX_MENUBAR_OFFSET 0
    #endif

    had the opposite effect to what was expected, it was hiding the menu in the editor so I had to use:

    #ifdef TORQUE_PLAYER
    #define OSX_MENUBAR_OFFSET 0
    #else
    #define OSX_MENUBAR_OFFSET 90
    #endif

    which seems to work. Like I say, could be something I did but is just a cut and paste :p
    #8
    02/17/2011 (1:57 pm)
    On quick question :)

    I've made the changes to the canvas.cs to try to stop the black console window, and this change does work, except the game window is then really small (even if adjusting the size in the editor), if I then call the setScreenMode anywhere in my game code I get the black window again :) Any ideas?
    #9
    02/18/2011 (12:39 am)
    Hey Gavin, Thanks for the fix! I've never really use the TGB editor on the Mac so didn't notice it at all.

    As for your new problem, I think I now know what causes the black console screen. It seems to be a problem with switching the screen size on the Mac, I'll have a look on that later. But for now, can you try opening up "common\preferences\efaultPrefs.cs" and change

    $pref::Video::resolution = "800 600 32";
    $pref::Video::windowedRes = "800 600 32";

    to
    $pref::Video::resolution = "[Your default Game Window Size]";
    $pref::Video::windowedRes = "[Your default Game Window Size]";

    And in "common\gameScripts\properties.cs" make sure that

    $Game::Resolution       =  "[Your default Game Window Size]";

    Please let me know how it goes.
    #10
    02/18/2011 (1:03 am)
    Thanks Aun

    I'll try this after work tonight and let you know :D
    #11
    02/18/2011 (2:06 pm)
    Sorted.


    the lines:

    $pref::Video::resolution = "800 600 32";
    $pref::Video::windowedRes = "800 600 32";

    were actually missing from the defaultPrefs.cs completely :S
    #12
    02/20/2011 (1:39 pm)
    Where can I find the console.log file now?
    #13
    02/20/2011 (4:49 pm)
    In your application home directory, something like "C:\Documents and Settings\[User]\Application Data"
    #14
    02/20/2011 (5:04 pm)
    That's where I thought it would be. Turns out I had integrated your changes into a heavily modified version of TGB instead of stock TGB. When I figured out what had happened I found the console.log file.

    Thanks :)