Game Development Community

Adding Player States with PSK?

by Michael "Doodle" Golden · in Torque Game Builder · 07/20/2009 (12:08 pm) · 10 replies

Alright, so I've gone through this tutorial: http://tdn.garagegames.com/wiki/TGB/PlatformerStarterKit/Animation_Tutorial God only knows how many times.

See, I can figure out code, but I'm new to TGB, and have no idea where this stuff is all supposed to go. Basically, I'd have a better shot at making it work, if I knew where to actually begin!

What I've tried so far is this:

The first snippet where it says.

The Actual States I've tried EVERYWHERE. (Except the Legacy files since they are obsolete.)

The Actor Code in ActorMethods.cs

and the final Snippet in ControllerBehavior.cs

I just wish more of these tutorials would explain what .cs files to actually alter. It's like all those 3DS Max books that require a predisposition of knowing what the crap you're doing already.

I'm very frustrated. xD

#1
07/20/2009 (12:36 pm)
Perhaps you'd have better luck posting in the Platformer Starter Kit. Phil, who developed the PSK, check there often and is very helpful.

If you're using Torsion, hit ctrl+shift+f and search for "PlayerClass::onAddToScene". The script that comes up should be the one that the new code goes in.

If you're not using Torsion, do a search (from whatever OS you us) on the game directory and search within files for "PlayerClass::onAddToScene". Again, whatever .cs file it finds, should be the right one.

Patrick
#2
07/20/2009 (2:09 pm)
Thanks Patrick!

The method, PlayerClass::onAddToScene, is inside game/gamescripts/PlayerMethods.cs (which is explained in the tutorial). It is also the same place that you can add your custom animation or physics states, but really, you can put any method or function anywhere you like as long as the files are executed.
#3
07/20/2009 (2:29 pm)
I added onto the "Shoot Behavior Tutorial" in the Private Forums. Since I still don't want to clutter it up. See, I'm trying to make an entire game, so since it's my first attempt, I'm bound to have a lot of questions.

Also, my most recent attempt looks something like this:

/// Mount the camera and update the gui
function PlayerClass::onAddToScene(%this, %scenegraph)
{
// Register Animation States.
%this.registerAnimationState("shoot");
%this.registerAnimationState("shootRun");
%this.registerAnimationState("shootJump");

////////////////////////////////////////////////////////////////////////////////
/// SHOOT STATE
////////////////////////////////////////////////////////////////////////////////

function PlayerClass::enterShootAnimationState(%this)
{
return "MyShootAnimation";
}

function PlayerClass::executeShootAnimationState(%this)
{
if ( !%this.Alive )

etc etc.

I've even tried them all outside of the initial on add to scene function, but hitting X gets no response.
#4
07/20/2009 (2:32 pm)
I apologize if I come off as an *** in any of my topics, but I only post when it's come down to utter frustration.

I'm the stubborn type. I don't like having to ask you, or anyone for that matter, for help, which is why I got irritable when you said, "I can't make everyones game for them =P."

Not cool.
#5
07/20/2009 (5:50 pm)
I post on the PSK forums very regularly and go to great lengths to help a lot of people. I don't want to make a game for you, I want you to learn to use the tools provided, otherwise what is the point? You might not like it how I said "I can't make everyones game for them =P.", but you cannot expect me to answer every query as soon as its asked, I am one person.

If you are unable to do some of the work yourself and are upset with the amount of time I dedicate to you individually, then you might be better off hiring or teaming up with a programmer to help you.

In any case, most, if not all of the information you have asked about has been provided to you - somewhere. If it isn't, then it is an error on my part and I will rectify it.

If you are frustrated with TGB or the PSK, then I urge you to put those thoughts down on a forum post, or email them directly to me (see profile). Feel free to tell me anything that you think is wrong with the tools I have provided and I will do my best to address them.

I just cannot spend vast amounts of time supporting individual developers.
#6
07/21/2009 (10:38 am)
Whoa whoa whoa. Let's be perfectly honest about this now. I have started four threads on your private forum. Two of which, had nothing to do with learning code, but rather things in the engine not working because of Vista. I had no way of knowing it was Vista, and not my own personal error.

The other two were started for different reasons: The Inputting my own Character thread was started because I did not understand WHERE the code was. If it had been an algorithim, then I would have figured it out on my own. It was just a question of where.

The New Character Ignores Gravity thread, was my personal goof. But, I figured it out before you replied to me, which is inconsequential if not for one thing:

The only things you've managed to help me with so far is, is the code for inputting my character goes, and making the PSK work in Vista. I have asked you to code NOTHING. - So please don't claim you have coded anything for me. Your posting of code I did not ask for. The only thing I asked for, was where to put code, if but my own.

I appreciate the help you have given me thus far, but I do not appreciate your saying that you did the work for me. The only thing I mentioned in one thread was this:

"I would try to keep asking all of this in one thread, but you never seem to come back Phillip. :/ "

In this post: http://www.garagegames.com/community/forums/viewthread/97217

Which got this reply: "I can't make everyones game for them =P

I suggest that you read this section of the existing documentation: tdn.garagegames.com/wiki/TGB/PlatformerStarterKit/UpgradeGuide_1_0_to_1_1#Actor_.... This provides all of the fields which give you control over the pskActor class, including jump height (pskActor::JumpForce) and enable/disable gliding (pskActor::AllowGliding)."

Joke or not, it's insulting, when all I am asking is to understand where code goes. There are a lot of .cs files, and they have different naming conventions than the ones used on the rest of the TGB forums without the PSK.

And my above comment was true: I would keep it all contained in one place, but after usually one response, you would disappear for a couple of days. I would take advantage of the time to try and solve it myself, but I still just couldn't wrap my head around how some of this works. And once you replied to other topics (Which I'm not at all attacking you for) I could only discern that you figured my problem was solved and moved on. So, I would make another post.

The fact is, half the stuff you would tell me was more like, "Isn't it obvious? You need to use this!" And I still had no idea what you were talking about!

Just please, don't act like I'm some kind of bad guy in all of this. I've been reasonable throughout and haven't asked anything extravagant of you. Only the understand you're suggesting I'm trying to avoid.

I'm not making some over-the-top adventure game that requires developers. It's a little more simple and personal than that. And it's not going to win me any fame or fortune. But I'm still going to put my best foot forward in finishing it.

Still, I thank you for your time and dedication, which you don't have to give. But the same goes for the forum you run... You don't have to do that either. So please... semantics.

Also: The current problem I am having is, once again, the location of all of the code is not clarified in the Animation Tutorial. It expects that I have a greater working knowledge of what's obviously going on.

If anyone would care to list where it all is supposed to go, and maybe why since I am still trying to figure out the functions of other .Cs files (Other than Datablocks Managed and Otherwise) I will personally go and edit the tutorial to show the change. If it's within my account allowances to do so.
#7
07/21/2009 (11:28 am)
All that talk and if you read Phil's first post here you would know that you can put the functions in any .cs file...
#8
07/21/2009 (12:25 pm)
Oh Geese. You people. xD

Did you even read my reply? Are you skim readers? I tried that! Incorrectly obviously, but still. I thought posts were a place for stupid questions.

Not a place to be called stupid for asking it.
#9
07/21/2009 (2:41 pm)
Michael, I am sincerely sorry if I offended you in any way, it certainly wasn't my intention. I don't think any one has said or really implied that you are stupid, we all started somewhere, didn't we?

In future, I will try to do more to help you as I have helped others.
#10
07/23/2009 (12:42 pm)
Don't worry about it. You've already given me help, my problem was I just didn't understand a word you were saying!

Hopefully, I can continue banging at this until I learn TorqueScript language. I'm heading to class soon, so I'll be giving this another go. The 5 hour and thirty minute long class should give me plenty of time.

I didn't intend to let my frustration get the best of me:

I apologize once again.