Archive for September, 2009

Creating A Splash Screen

Been scouring the web for information on building GUIs in Torque Game Builder and came across this tutorial for making a splash screen:

Creating A Splash Screen In TGB

It’s a very short and easy-to-understand tutorial, thanks to Christopher Ross.

I’m taking that tutorial as a launching point and doing more GUI stuff, with buttons, etc., and as soon as I have something figured out I’ll post it here.

2D Game Building for Teens – Errata #3

Found a few problems in Chapter 7 of the book.

When you create the MeanBat object, step 9 on page 191 references a coin, but it means bat. But the big thing is they don’t tell you to check the Callback checkbox in the World Limits rollout.

Without that the enemy bats will just keep flying instead of turning around and wreaking havoc (which is what we want).

Code problems — the code on page 194 (and repeated on page 196) has three problems — all the same thing is wrong.

You’ll see reference to this in some of the lines:

%this.getRandom(%this.minSpeed, %this.maxSpeed)

That won’t work because there is no getRandom() function that’s part of the %this object — what should be there is this:

getRandom(%this.minSpeed, %this.maxSpeed)

That’s right, just knock off the %this. and you should be good. You’ll find that error in three different places in the code.

Also on those pages you’ll see a couple “case” statements, like this:

case "left"

You need to add a colon to the end of that:

case "left":

Do the same thing for the case “right” statement.

Update to TGB/Jennings Glitch

In a previous post I talked about getting an Invalid Project Data error message — which had stopped us in our tracks. But I think I found a fix — and it has nothing to do with code!

We built the game initially in this location:

:Applications:TorqueGameBuilder:tgb:MyGame

It worked fine until we closed up shop one day and tried to reopen it later — that’s when we got the Invalid Project Data error message.

Tonight I moved the project folder to this location:

:Applications:TorqueGameBuilder:games:MyGame

Lo and behold, it works fine. Everything loads, the game runs fine, etc. Looks like we’re back in the saddle, yeehaw!

I guess I can understand TGB being picky about where things are, but since it worked correctly as we built the game, it seems like it should have worked once the game was reloaded, too.

But it’s working now, which is the main thing.

Problems with 2D Game Building for Teens

Tom and I are posting problems and fixes to the code in this book as we come across them, but if we miss something, please leave a comment and let us know — we’ll add it to the list so people just getting into the book won’t have as hard a time.

Thanks!

TGB Glitch? Or Jennings Glitch?

Tom and I are kind of stuck in our learning of Torque Game Builder. We’ve been going through the 2D Game Building for Teens book and after fixing the code mistakes things are fine.

Well, things were fine.

The problem we’re having now is launching the project — we’re getting an Invalid Project Data error.

None of the graphics show up, although they’re still in the project, just all blank.

I can change the path of the images in the datablocks.cs file and then the graphics show up when the project is loaded. But then when I try to play the level the graphics are blank.

So I can load the graphics when the datablocks.cs path is one way, and then see the graphics when I run the level when the path is the other way.

It’s the kind of thing that makes me think it’s TGB’s fault, but I can’t find anything “official” on the GarageGames site.

It’s kind of brought things to a halt for now — at least as far as finishing the sample game from the book.

2D Game Building for Teens – Errata #2

Here’s another big problem from the book 2D Game Building for Teens. Yes, the code examples are in rotten shape but the book as a whole is a good intro to Torque Game Builder — just make sure you keep checking back here for the fixes. =;)

On pages 163 and 169 the book shows the code for player.cs — and besides the problem shown in Errata #1 on this site, there is a huge chunk of the code shown that shouldn’t be there.

Basically, these functions…

BattyPlayerUp()
BattyPlayerDown()
BattyPlayerLeft()
BattyPlayerRight()

…are duplicated.

The first set shouldn’t be there — just rip those four functions right out and you should be good to go.

2D Game Building for Teens – Errata #1

The book, “2D Game Building for Teens” by Michael Duggan is the only book I’ve seen that covers Torque Game Builder — and since my son Tom is 15 I figured this book would be a great starting point for him.

Yes, and no. The book itself is very cool — but the code examples have some major problems.

My son spent hours getting to a point in the book where things just stopped working…

…the w, a, s, and d keys are supposed to move a flapping bat around on the screen.

Nada.

He spent hours trying to figure out what was wrong — he’s not a programmer (yet) so he had no idea what to look for. I finally found it after spending too long trying to find the typo in his code — turned out it’s a mistake in the book, he typed everything in correctly.

Hey, mistakes happen, right? So where’s the errata on the author or publisher site? It’s just freakin’ irresponsible not to have that available — especially for something that’s aimed at newbies.

So, for anybody else who comes across this problem, it’s caused by this line in player.cs:

$MeBatty = %this;

In that line you’re setting the global variable $MeBatty to the object that’s passed in to the function, but then other functions are referring to $BattyPlayer, not $MeBatty.

To fix player.cs (the full thing starts on the bottom of page 155 in 2D Game Building for Teens), just replace that $MeBatty line with this:

$BattyPlayer = %this;

Your bat should now fly around using the w, a, s, and d keys.

What Is TorqueNation?

It’s a place where people who write in TorqueScript or who use Torque Game Builder, Torque 3D, etc., can find tutorial videos, code snippets, etc.

Of course the GG site itself has a community of people who can’t be beat, so why TorqueNation? Because it’s good to be the king.

I mean, so there’s a place my son and I can post things about Torque and I don’t have to worry about whether it’s in the right spot, etc. Oh, and so I can try and monetize my work with Torque.

How’s that for being up-front and honest? =:)

Anyway, I hope as this site grows you will find information that will help you develop your own games using the Torque products.