Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

8-direction movement!

I want an 8-direction movement script for my game, but my problem is that most of that kind of scripts have too much inuseful extra things. I don't mean to hurt anybody's feelings with my opinion, but it's simply too complicated for a script-n00b like me to cut out the extra from those scripts. The script I really need would do this:

  • Make player (ONLY player! Not npcs!) move in 8 directions
  • Make player use separate sprite file for NE SE NW SW directions
  • NOTHING ELSE!

I could do this with common event, but the problem is that common events for moving make all other "move player" commands to 'not work' (sorry my bad english. I don't know any words for "not work" :)

Ps. The separate file looks like this: http://www.univelka.net/rmxp_res/001-Fighter01B.png
Pps. I don't know who has made this sprite. If someone recognises his/her work, please tell me so I can give credit.
 
Sorry that I'm bumping already, but I figured out myself how to add 8 directions by scripting:

 
def update_player_movement
# Move player in the direction the directional button is being pressed
    case Input.dir8
    when 1
      move_lower_left
    when 2
      move_down
    when 3
      move_lower_right
    when 4
      move_left
    when 6
      move_right
    when 7
      move_upper_left
    when 8
      move_up
    when 9
      move_upper_right
    end
  end

I don't know how to use the different sprite file for the SW SE NW NE directions, so I would still want to have some help with that one. Thank you already.
 
Just do tto use the 8 dirs now for the actual CharacterSheet just make that if you move in any of that directions change the sheet to the eight dir @character_set = "NAME HERE"  you might need to fix the directions though:
Code:
class Game_Player < Game_Character
 
def update_player_movement
# Move player in the direction the directional button is being pressed
    case Input.dir8
    when 1
      move_lower_left
    when 2
      move_down
    when 3
      move_lower_right
    when 4
      move_left
    when 6
      move_right
    when 7
      move_upper_left
    when 8
      move_up
    when 9
      move_upper_right
    end
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top