Keyboard Movement... With key pressed

Started by NsMn, Tue 12/05/2009 17:47:16

Previous topic - Next topic

NsMn

Hi,

I'm currently looking for a script for keyboard movement.
I kno, theres a module, but It should only walk if the key is being pressed (like Jump'n'runs, e.g. Trilby:Art of Theft)
Do you know how to do this?


Ghost

The code for that is already in the default AGS game- you just need to alter one line in your game's GLOBAL SCRIPT.

OPen up the global script, find game_start, and there, change:

Code: ags

KeyboardMovement.SetMode(eKeyboardMovement_Tapping); 

to
Code: ags

KeyboardMovement.SetMode(eKeyboardMovement_Pressing); 


.M.M.

#2
You can use two modes in Keyboard Movement module: eKeyboardMovement_Tapping, and eKeyboardMovement_Pressing. Put this line into your game_start function:
Code: ags
 KeyboardMovement.SetMode(eKeyboardMovement_Pressing);

[EDIT] Sorry, I didn´t see your post, Ghost.

Matti

From the module's readme:

Three modes are currently available:

 * eKeyboardMovement_None: Keyboard movement disabled (the default)

 * eKeyboardMovement_Pressing: Player walks while the direction key is pressed.
   Releasing the key stops the character.

 * eKeyboardMovement_Tapping: Player starts walking when direction is pressed
   once and walks until key is pressed again. Numpad-5 also stops him.

So what you're looking for is eKeyboardMovement_Pressing, if I understand you correctly.


Ah, Mirek beat me. Oh, and Ghost too.

Khris


Ghost

Quote from: KhrisMUC on Tue 12/05/2009 18:27:14
It's high time:
RTFM.

Actually, no, since the keyboard movement script isn't covered in the manual- you can figure out how to change the settings of the module after reading the module documentation.
Maybe a short notice in the main script could be added?

Generally spoken you're totally right though, I think we had the same question a couple o'dozens of times.  ;)
We need a cool acronym for Do A Friggin' Forum Search.


Trent R

Technically, the module's manual is right in the header, so his acronym still works.

But I do like DAFFS, or maybe STFF to keep in the same rhythm?
[Edit]: Or maybe FITF (Find [it] In The Forum)?


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Khris

How about "Search The Forums, You!"
Acronym: STFU ;)

NsMn

Sorry, but I found something... a-v-o's script helped, but although, thank you very much.

SMF spam blocked by CleanTalk