Game Development Community

TDN Platformer Tutorial

by Adam Larson · in Torque Game Builder · 10/11/2005 (8:49 pm) · 55 replies

For those of you waiting for the 1.02 version of the platformer tutorials, here is an update.

I added 1.02 compatibility to the first article of the platformer tutorial on TDN. The first article was the only real show stopper for use with the current T2D version, so only minor tweaks should be necessary to get the rest of the code working. I'll add the specifics in the coming days.

Also, I am a horrible artist, so if there's anyone out there that wants to help out by providing some art, let me know. Since these tutorials are mainly code based, it's not imperative that I get good art. But, it would give a much better initial impression of the tutorials if they looked good. Specifically, I need a tile set for the sample levels and a character with run, jump, and dieing animations.

Any comments, suggestions, or critiques on the tutorials are welcome and encouraged. My goal is to reach a feature and quality level fit for a starter kit and I can't get there without feedback.
Page «Previous 1 2 3 Last »
#1
10/11/2005 (10:45 pm)
Like you said, I've only had to do minor tweaks, mostly renaming of t2d stuff back to fx...2d.

Other than the platform clamping stuff you've already modified, one function in the camera code doesn't work, specifically this line:
$camera.setLimits(%layer.getArea(), true);

There is no equivalent to layer.getArea() in 1.0.2 that I've found. However, the following code appears to work as intended (I've also added it to TDN):
%tileCount = %layer.getTileCount();
%tileSize = %layer.getTileSize();
%SizeX = getWord(%tileCount,0) * getWord(%tileSize,0);
%SizeY = getWord(%tileCount,1) * getWord(%tileSize,1);
$camera.setLimits( "-" @%SizeX/2 SPC "-" @ %SizeY/2 SPC %SizeX/2 SPC %SizeY/2, true);
#2
10/12/2005 (12:26 am)
Adam: My MannequinMan animations are free for use. They're all rendered out as individual PNG files so will need pulling together into an imagestrip, but if you want to use them, feel free.
#3
10/12/2005 (6:13 am)
@Phil,
Thanks for the free MannequinMan animations. 1 quick suggestion would be to add a link to your website in the readme. I realize the company name is there, but it would still require a google search to find out it's.co.uk and not .com.
#4
10/12/2005 (6:32 am)
D'oh! Thought I did that. It's updated now though.
#5
10/12/2005 (1:20 pm)
Thanks Tom. I did change your code a little bit for clarity's sake.

@Philip:
I'll see if I can get those animations integrated pretty soon. Thanks! Any chance you'd be willing to add more animation sequences? I just wrote up some ladder code and it would be nice to have a climbing animation. I'm also considering ledge grabbing, among other things.

I also noticed a problem with the setTarget function of the camera in 1.02 (Release only, Debug works fine). I'm assuming it's related to the camera position not getting initialized when it is created. I'll add a fix when I get home today.

And, there are I think two calls to vector math functions in the camera code that need to be changed from t2dVectorAdd to vectorAdd2D.
#6
10/12/2005 (1:46 pm)
I don't see why not :) I'll probably redo the jumping animation as well, as he looks like he's trying to imitate a frog in the current set...
#7
10/12/2005 (4:05 pm)
@Adam
I'm having another problem with the camera in 1.0.2. Basically it does not move when the character moves, but if I move my mouse cursor around then it will align itself with the character. It's really strange because there is absolutely no code referencing the mouse at all and it doesn't matter where the mouse moves, it just has to move. For example, I can move the character from the left side of the level all the way to the right side. The camera should follow the character and scroll the background but the character is moving completely off the screen. I can then move the mouse up , down, left, right, in circles, it doesn't matter, it just has to move then the camera flies across the level to center on the character.
Do you have a working version on 1.0.2 or any idea what the problem might be?

It's also using about 95% of my CPU when running the demo. I've looked for info on using the profiler, there just isn't very much on using it in script. I'm going to have to dig into the source on that one, but I think it probably is related to the issue above.
#8
10/12/2005 (7:48 pm)
@Adam
I'm having problems too in 1.0.2 :( my camera doesn't move at all. Also gravity doesn't seem to be working well, my GG character floats down very slowly and when I jump or run into something it goes flying.
#9
10/12/2005 (7:59 pm)
@David
There is a difference in the gravity scale between 1.0.2 and 1.1. Try multiplying your gravity by 10. For example if you have it at 700, try making it 7000.
For your camera not moving see if it's the same issue as mine. Move your character off the screen, then try moving your mouse around to see if the camera moves to catch up with the character.
#10
10/12/2005 (8:06 pm)
@Tom
Thanks that helped out; the character movement is still a little wonky though. Did you play with the materials at all?

The camera didn't move. :( I'm pretty tired right now so I guess I'll try to figure it out tomorrow.
#11
10/12/2005 (8:16 pm)
@Tom:
Hmmm... Couldn't replicate that. I do have a version that works which I have emailed to the address in your profile. I'm also going to upload my final code to TDN once I am confident in its quality.

@David:
The gravity problem is a result of 1.02 requiring much greater forces to achieve the same affect. Try something like 100000 instead of 700. I have updated TDN to reflect this.

The camera problem is probably a result of what I said in my last post. In client.cs if you change the two lines
createCamera();
createLevel();
to
schedule(0, 0, createCamera);
schedule(0, 1, createLevel);
Kind of hackish, I know, but I don't want to change anything major when the 1.1 version works fine.

Let me know if that solves anything. I'll hopefully be working on this a bunch tomorrow during which I will try to get the articles cleaned up and a couple more posted.

@Philip:
Awesome! Thanks. I'll hopefully get to changing the animations over to the mannequin man tomorrow.
#12
10/12/2005 (8:26 pm)
@David:
Could you describe in a little more detail the character movement? There are two minor problems I know of.

The player still slides down inclines that it is supposed to be able to walk up. That is fixed in the animation tutorial because it made more sense there. Also, the ggLogo sort of vibrates up and down when moving along the platforms sometimes. That definitely does not happen in 1.1 and I think is minor enough to let go until 1.1 is released. It doesn't seem to happen with the animated character as I think it has to do with the octogonal collision poly.

If it's something more than that, let me know and I'll see what I can figure out.
#13
10/12/2005 (8:53 pm)
@Adam,
I got your email and tried running it with your files. It is still happening.
I'm still in Eugene because I stayed for the indie boot camp. I'll try it on my desktop when I get home tomorrow evening and see if it works there. Maybe it's just an issue with my laptop...
#14
10/12/2005 (10:46 pm)
It would be good if you posted the complete .cs torquescript after the tutorial, as a lot of people have syntax errors and a nice way to figure it out on their own would be to look at a 'good' source
#15
10/12/2005 (10:56 pm)
Yeah, I'm planning that. Actually - I'm just going to upload the files because by the end there's quite a bit of code. I'll try to get that done tomorrow. The files I upload will be fully commented, so anyone who wants to skip all the tutorial fluff and just get some code will be appeased.
#16
10/13/2005 (5:16 am)
@Adam,
The player seems to accelerate very quickly and there are some gravity problems (when the player jumps, it leaves the screen for a while). As well I'm seeing the two minor problems you mentioned. Except the ggLogo will launch off the tile and go flying (I'm assuming that's a combination of the vibration problem and my gravity problem).

I haven't tried the gravity value you suggested yet as I'm not at home. I'll try it out tonight and see what happens.
#17
10/13/2005 (9:31 am)
I have gravity set to 100000 right now in my build and it works pretty well. Obviously you'll want to tweak the value slightly to get the feel that you want. But, it sounds like something else wierd is going on, too. If you want to see my code, I'll probably have it uploaded to TDN before tonight.
#18
10/13/2005 (9:34 am)
@Adam,
Thanks I really appreciate that, I'll check it out tonight.
#19
10/13/2005 (3:08 pm)
Good work thx.
#20
10/13/2005 (3:19 pm)
@Adam,
Setting the gravity to 100000 did the trick. :)
Page «Previous 1 2 3 Last »