Looking for some resources in doing a 2D platformer
by Adam McCarthy · in Torque Game Builder · 01/02/2010 (7:06 pm) · 2 replies
I've been doing some searches and working through the tutorials, but I keep wondering if I am just missing a better resource for my needs.
Basically, to get a handle on TorqueScript and TGB in general, I am trying to rebuild River City Ransom. This covers a lot of the stuff I'd like to do for a 2D game project, but I am not seeing a lot of the things I am stuck on, specifically:
- Setting a sprite for when a character is just standing still, yet switching the sprite to use based on which direciton the character is facing.
- Changing from the standing still static sprite to animated ones for running, punching, kicking, jumping, etc (again the direction part is also important).
- How to make a level say 800 px, starting the player in a 200 px area, then moving along forwards (and backwards).
- Each scene is a level, with changes of scene being left/right, sometimes up/down...but it is pretty open so the player should be able to go anywhere they want through the levels (as in start in level 1, keep moving right to say level 4, but then being able to double back to level 1).
Again, if anyone has played River City Ransom, that gives a pretty good idea of what I am trying to duplicate as I learn.
Any suggestions about the best resources to use to work through the above areas I am not clear on would be great.
Basically, to get a handle on TorqueScript and TGB in general, I am trying to rebuild River City Ransom. This covers a lot of the stuff I'd like to do for a 2D game project, but I am not seeing a lot of the things I am stuck on, specifically:
- Setting a sprite for when a character is just standing still, yet switching the sprite to use based on which direciton the character is facing.
- Changing from the standing still static sprite to animated ones for running, punching, kicking, jumping, etc (again the direction part is also important).
- How to make a level say 800 px, starting the player in a 200 px area, then moving along forwards (and backwards).
- Each scene is a level, with changes of scene being left/right, sometimes up/down...but it is pretty open so the player should be able to go anywhere they want through the levels (as in start in level 1, keep moving right to say level 4, but then being able to double back to level 1).
Again, if anyone has played River City Ransom, that gives a pretty good idea of what I am trying to duplicate as I learn.
Any suggestions about the best resources to use to work through the above areas I am not clear on would be great.
About the author
#2
01/03/2010 (7:01 am)
The platformer tutorial on TDN provides an example of switching animations. The jumping physics doesn't work properly in TGB 1.7.4, so I would ignore that part of the tutorial but the player animation section can hopefully help.
Torque Owner Eric Paik
Second, if you don't have Torsion, seriously considering getting it. I don't want to think about how much a pain in the ass writing code/debugging would be without it.
Third, complete a couple of tutorials. I recommend either the Fish Game tutorial or the Fish Demo. Neither will teach you things that will be directly applicable to what you want to do, but crawl before you walk etc. I also recommend not learning about behaviors and teaching yourself script solely. Some might disagree, but anything you need to do with behaviors you can do in script and script is much more flexible. Trade off is script is going to require more work.
Fourth, I'll drop some hints as to how to do your questions.
Q1. Documentation on Animated Sprites
Q2. When you load an image\animation using the editor, it has no knowledge of which "direction" it is facing. AFAIK, the editor does not allow you to input custom data for whatever images you load in. \game\managed\datablocks.cs holds all information for the images that you load in through the editor there. You can add custom fields in manually. Thus you can tell your manPunchingImageMap that you loaded that it has a var called facing that is set to "left".
Q3 and Q4 are something of a package deal depending on how you implement what you are asking. Also it will take a lot more explaining. So I'll hold off on that for now.