Game Development Community

the bind method

by Tim Lei · in Torque Game Engine · 05/14/2002 (11:41 pm) · 6 replies

Hello experts! I'm looking at the bind method and it seems to me the bind method binds a key on the keyboard to a script function so that when the key is press, the function will be called. My question is, the script function ussually takes in parameters (for example, moveforward(%val) takes in %val), and i don't know how the value gets passed to the function? Thanks!

#1
05/15/2002 (12:26 am)
found in :
../torque/engine/sim/actionMap.cc

in the function :

bool ActionMap::processAction(const InputEvent* pEvent)

:)
#2
05/15/2002 (12:59 am)
Thanks for your help! I also want to know what actually happens if a button is pressed (for example, "f") what important fucntions are called and what actually makes the character move? Thanks again!
#3
05/15/2002 (1:13 am)
Ok
by studying the afore mentioned function.
you can see that a script command is built then executed.

so the action map controls the bindings and process's them as well.

there are globally available script variables used for player movement client side these variables are operated by one of the binded functions.

the operation of these variables happens in:
../engine/game/gameConnectionMoves.cc
bool GameConnection::getNextMove(Move &curMove)
this move is prepared to be later processed by the player when the GameConnection gives it to him :)
#4
05/15/2002 (2:06 am)
ok, so how does the animation of the character link to the bindings of the keys? If i have all the animations, how do I bind them to a specific key? thanx again!
#5
05/15/2002 (2:58 am)
it really depends on where you want to go with it.

for example.. looking at how the script code does wave answers this.

but also so does the afore mentioned function that prepares the move for player.
and then the animation is handled in the Player class

the biggest thing to note here is the ability to find what it is your looking for, example:
you want to know how an animation is used ..
im sure by now your familiar with the binded available commands .. so you should be able to use the IDE your are using to do a find in file for the names of the command of interest.

the ability to track down information on your own can define your ability in this field.
#6
05/16/2002 (12:26 am)
Alright, thanks for your advice.

Now I believe that animation sequences are not triggered by keys. Instead, keys change some states or variables, and animation sequences are played according to the states the shape is in, such as running forward or jumping.

However, the problem is that it is really confusing which object is responsible for which purpose.

Now, I know TSShapeConstructor takes animation sequences name strings. But then what does it do with it? Does it load the actual sequence to the resource, which is of TSShape type?

So if I want to change the animation sequences of the game, for instance, if I want to make animation of a monster, who doesn't run ro walk, but move in a weird way, or I actually have to change is the animationlist in player class, and the sequence definitoin in tsshapeconstructor. Is that correct?

I am far from certain about this because the engine is very complicated without proper comments.

Thanks for your valuable advice and help!