Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: strazer on Wed 21/09/2005 01:10:48

Title: MODULE: KeyboardMovement v1.02
Post by: strazer on Wed 21/09/2005 01:10:48
This simple script module makes it easy to allow moving the player character using the keyboard. It is based on a-v-o's code from this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=8303).

Features
* Move the player character with keyboard keys
* Choice of two control modes: Pressing or tapping direction keys

Download here (http://www.strazer.net/ags/KeyboardMovement.zip) (Script module and documentation)

Ideas for future releases include key customization features and interaction functions.

Edit:

Check out the coding competition entries for modules that include interaction functions: http://americangirlscouts.org/agswiki/index.php/Coding_Contest#Keyboard_Control
Title: Re: MODULE: KeyboardMovement
Post by: Pumaman on Wed 21/09/2005 20:19:34
Good idea, having this available as a module should make things a lot easier for newbies than having to copy & paste code into their scripts :)
Title: Re: MODULE: KeyboardMovement v1.01
Post by: on Thu 17/11/2005 20:17:55
its not that bad, just not ideal. When the character moves he sort of lags from update to update when you continuously hold down the button. Its because of that function walkstraight(). I think Kinoko's game GOA is a good example. I think she uses your module. It doesn't move cleanly if you know what i mean.

It's not unresponsive, just a small delay between each character position update.

I downloaded the module and found the exact same lag in your module. So i went for a different approach. But i think the amount of workarounds (for the perfect smooth movement) will be huge in collision detection etc. Everything that function (walkstraight) includes.

If i can successfully achieve all those workarounds then i'll post it here, but for beginners i think you module is ideal.

Title: Re: MODULE: KeyboardMovement v1.01
Post by: Bernie on Fri 18/11/2005 13:13:17
I think the problem you describe is caused by the anti-glide mode. You could try to deactivate it and see what result you get.

Or, if for whatever reason you need a keyboard movement that works without WalkStraight(), you could try my 8-dir module:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=21766.0

It acts directly on the x and y coordinates of the character and supports slow speeds as well.
Title: Re: MODULE: KeyboardMovement v1.01
Post by: on Sat 19/11/2005 10:59:30
thanks bernie, turning anti-glide off fixes it. Might as well use my own movement thing now.

Your keyboard module is perfect rui and strazer, sorry.  :P
Title: Re: MODULE: KeyboardMovement v1.02
Post by: strazer on Sun 30/03/2008 00:40:36
Version 1.02 now up:

- Bugfix by Rui "Trovatore" Pires: If you changed rooms, sometimes you had to double-tap on the next room in order to get the player moving again
Title: Re: MODULE: KeyboardMovement v1.02
Post by: Elessar on Fri 02/05/2008 18:31:49
Great module! Would it be possible to make it so that if you pressed two buttons (such as down & right), that the character would move on a diagonal? I know that this can be accomplished using the 1,3,7,9 buttons on the keypad, but most people that I know prefer the standard arrow keys.

P.S. The txt file still says KeyboardMovement_101.scm instead of KeyboardMovement_102.scm in section 4. Setup.
Title: Re: MODULE: KeyboardMovement v1.02
Post by: Rui 'Trovatore' Pires on Fri 02/05/2008 20:27:20
This already happens if you set it to "Pressing". If you set it to tapping it's kind of a blind-man's-game which gets recorded - direction 1, direction 2, or the diagonal in-between. So I think we'll leave it as is. ;)