Archive for category Torque 2D

Beginning Game Programming – Torque Game Builder Tutorials

Over the next two weeks I’m putting together a course that’s going to be aimed at homeschoolers in my area of Alaska. But I’m also going to be making it available online for people who are trying to get into beginning game programming.

After looking at several options I’ve decided that Torque2D is the best overall choice available. Cross-platform, fairly cheap, and powerful.

As soon as I have an outline done I’ll post it, but if you want to be notified ASAP, see the “Stay Torqued!” section on this page and join the list — I’ll be sending out info to that list even before posting here.

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.

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.

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.