Author Topic: MODULE: 8-Direction Movement v0.1  (Read 4298 times)

MODULE: 8-Direction Movement v0.1
« on: 11 Jul 2005, 17:13 »
This is my first go at a script module thing. This is an attempt to simulate a movement similar to the ones in games like Chrono Trigger or Terranigma.

Speed, character widths and other things can be altered through functions. I've also added a Thrust() function which allows for the character to be pushed around. Maybe useful when he's colliding with an enemy, or something.

I've added an explanation for each value in the module's description. Please try it out and let me know if you find this useful.


EightDir.SetSpeed(int x, int y);
             Sets character speed. Can be changed at any time.
             You could, for example, make the character run
             faster when a button is pressed down.

             SetSize(int x, int y);
             Sets the size of the character's collision width
             and height.

             WalkViewSpeed(int speed);
             Sets Speed of the walking view.

             SetWalkView(int view);
             Sets a new walking view used by the movement.

             SetSlide(int value);
             The lower this value is, the slower the character
             will get to full speed and stop.
             Disable(bool value);
             Disables the movement. Set to either 1 or 0.

             NoDirSet(bool value);
             Disable the movement's internal direction setting.

             DiagSlow(bool value);
             If this is true, the character will only move
             at 70% when walking diagonal.

             Thrust(int x, int y);
             Pushes the character into a direction. Useful
             when the character is being hit or similar.

             EightLoopsMode(bool value);
             If this is true, the movement will utilize 8 loops
             instead of 4.

             Returns if the player is currently being moved.

             Returns wheter the function Thrust() is still active.

Download here

I've also made a small platform engine recently. It works well, but the code is very messy. It's not a script module, just an experiment:

http://www.origamihero.com/files/plat2.zip (Use space bar to jump)
« Last Edit: 05 Jul 2006, 10:47 by strazer »


  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: MODULE: 8-Direction Movement v0.1
« Reply #1 on: 07 Jun 2006, 05:50 »
Sorry for bumping this, but:

I've tried out this module today and after wondering for ten minutes why it wouldn't work correctly, I found the problem:
The character's normal view in AGS must not be set to the one set by EightDir.SetWalkView(); Otherwise the player doesn't animate.

I'm not exactly sure why, though. Seems like locking the char to his normal view isn't appreciated by AGS.
Fail at Floaty Rog' now!  still having to deal with what games are going through

Re: MODULE: 8-Direction Movement v0.1
« Reply #2 on: 07 Jun 2006, 12:42 »
Yes, that's how it is - I mentioned it in the readme file. You can assign a normal (stopped/walking) view, but the EightDir.SetWalkView needs to be different for a reason I don't remember.