Sorry for such a late response; I'm finalizing a script I'm about to release. It seems this is more complicated than I thought, and as soon as I get the chance I'll be writing a proper response, but for now:
Your commands and how you arrange / display them honestly doesn't have anything to do with how the actor sprite should be positioned / drawn on screen; or rather, they shouldn't be intertwined with it. The system code and graphical code should be split into two parts, not intertwined. The graphical part of the system should use the systematic part to work, not the other way around. This is why Spriteset_Map isn't available anywhere but in Scene_Map, and there is Game_Character and also Sprite_Character; it keeps things organized and tidy, and easier to maintain. I would recommend following this archetype, it works really well for our sanity
:p
Like so:
class Scene_Navigate def start @paths = <some code to make paths> @actor_sprite = Sprite_NavigateCharacter.new # some special non-32x32 movement actor sprite @command_window = <your command window here>.new(x, y).deactivate ...other stuff, etc... end def update super return if @command_window.active if Input.dir8 != 0 update_actor_sprite_position end if @paths.any? {|path| path.endpoints.include?(@actor_sprite.x, @actor_sprite.y) } @command_window.activate end end def on_command_window_ok path = @paths[@command_window.symbol] @actor_sprite.start_to_walk_on(path) endendSe what I did there? I separated the two parts of the system, the path code and the graphical code, and manipulate the graphical part in the scene.Here's some more tips:
- The 8D movement can definitely be emulated. Simply add 4 more rows to the sprite graphic and alter Sprite_Character#set_character_bitmap and Sprite_Character#update_src_rect accordingly.
- Don't use Sprite_Character directly. Either subclass it and rewrite the update_position method, or write a new Sprite_MapCharacter or something; we need to be able to set the sprite's coordinates directly.
- I would recommend creating a Path class, which holds a bunch of points (which constitute a path), and adapt the code below to it.
Here's some code(read: food for thought) that should kickstart you on how you can determine where the sprite should be at when:
Code:class Line # p1 and p2 are arrays: [x, y] def initialize(p1, p2) @p1, @p2 = p1, p2 end def distance(p2=@p2) (@p1[0] - p2[0])**2 + (@p1[1] - p2[1])**2 end def next_point(x, y, reverse = false) np = [x, y] delta = distance - distance(np) # Here we basically reverse the distance formula to get our new point step = reverse ? -1 : 1 t = delta + step # This is code that moves a value over time, or in this case over distance nx = distance * t / distance + @p1[0] ny = distance * t / distance + @p1[1] return [nx, ny] endend
This code creates a Line class that lets you get the next point in the line <step> distance away from where you are on that line. Another adaptation of this is Jet's tween script. Basically we calculate the next position depending on a delta change in some value, an overall change, the start value, and a duration (which in this case is the overall change as well). eg:
Code:def next_value(time, start, overall_change, duration) return change * time / duration + startend
Does that help a bit? I'll definitely be back in a bit after I wrap up my script so any more questions will be answered then.
:)