direct keyboard control of character movement?

Started by SHUFTY, Mon 30/11/2009 22:41:04

Previous topic - Next topic

SHUFTY

Hi all

Is it possible to make a game with the AGS editor where the player character's movement can be directly controlled, i.e. by keyboard or joypad input rather than mouse? Is there perhaps a module i could use? (I couldn't find one when i looked). Although I have plans to make the sort of point and click adventure game for which AGS seems to be intended, I'd also like to try out some ideas for a 2d top down 3rd person shooter and a side scrolling platformer. If it really wouldn't be possible to do either of the latter in AGS, can anybody recommend a similar style program in which it would be possible? Any help would be much appreciated!

Khris

The default game contains a customizable keyboard module.
AGS doesn't support joypads yet, but just google JoyToKey, a small but great freeware tool that lets you assign keyboard keys to joypad buttons. You (and everybody else playing your game) would have to have it running it in the background though.

Doing both those games is possible, however a fair amount of scripting will be needed. A jump-n-run would require pretty extensive gravity, movement and collision code, for example.

There are numerous game engines out there (Games Factory is one I can think of), just ask google.

SHUFTY


suicidal pencil

#3
Quote from: Khris on Mon 30/11/2009 23:21:36
A jump-n-run would require pretty extensive gravity, movement and collision code, for example.

Very true. Coding in physics is hard work, and can easily break your game if you did anything wrong.

Anyways, to code in movement by keyboard, just put this in the repeatedly execute function:

Code: ags

if(IsKeyPressed(eKeyUpArrow))
{
  player.y -= 5;
}

if(IsKeyPressed(eKeyDownArrow))
{
  player.y += 5
}

if(IsKeyPressed(eKeyLeftArrow))
{
  player.x -= 5;
}

if(IsKeyPressed(eKeyRightArrow))
{
  player.x += 5;
}


you can substitute the number 5 for anything, depending on how fast you want your character to move. (EG. moving at 5 pixels per frame, at a resolution of 640x480, it would take 128 frames (or 3.2 seconds at 40 fps) to move from the top of the screen to the bottom, and 96 frames (2.4 seconds at 40 fps) to move from one side to the other.)

NsMn

Are sure it's that easy pencil? Don't you usually have animations?  ;)

Calin Leafshade

actually coding basic physics (gravity) is not that difficult.

The core principle is just to have an acceleration vector along with velocity vector.

so you add your acceleration to your speed and then add your speed to your posistion.

just make sure you clamp your speed otherwise your character will go into warp speed very quickly.

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

barefoot

Hi

thats the sort of effects you get from Klik n Play game engine..

Cool

barefoot
I May Not Be Perfect but I Have A Big Heart ..

suicidal pencil

Quote from: NsMn on Tue 01/12/2009 05:47:11
Are sure it's that easy pencil? Don't you usually have animations?  ;)

the question was: "Is it possible to make a game with the AGS editor where the player character's movement can be directly controlled, i.e. by keyboard..."

I think I answered it  :P

SMF spam blocked by CleanTalk