I started writing a pixel movement script, in the form of a dev log.
You can read the first part here here.
A WIP version of the script can be found here.
Update: Oct 5, 2014
The second part of the dev log series has been published: click here to read the full version.
Part 3: Event Interaction
You can read the first part here here.
A WIP version of the script can be found here.
The script so far is about 20 lines:
module TH module Pixel_Movement Pixels_Per_Step = 4 Tiles_Per_Step = Pixels_Per_Step / 32.0 endendclass Game_Map include TH:
ixel_Movement def x_with_direction(x, d) x + (d == 6 ? Tiles_Per_Step : d == 4 ? -Tiles_Per_Step : 0) end def y_with_direction(y, d) y + (d == 2 ? Tiles_Per_Step : d == 8 ? -Tiles_Per_Step : 0) end def round_x_with_direction(x, d) round_x(x + (d == 6 ? Tiles_Per_Step : d == 4 ? -Tiles_Per_Step : 0)) end def round_y_with_direction(y, d) round_y(y + (d == 2 ? Tiles_Per_Step : d == 8 ? -Tiles_Per_Step : 0)) endendAnd it accomplishes "pixel movement".Now, there are two things that need to be addressed before this is considered market-ready:
1. Improved collision detection (so it doesn't look like you're walking into a wall)
2. Improved event trigger
Both issues stem from the same thing: collision detection in RM is extremely simple based on a single check of the character's position.
How can this be improved?
module TH module Pixel_Movement Pixels_Per_Step = 4 Tiles_Per_Step = Pixels_Per_Step / 32.0 endendclass Game_Map include TH:
1. Improved collision detection (so it doesn't look like you're walking into a wall)
2. Improved event trigger
Both issues stem from the same thing: collision detection in RM is extremely simple based on a single check of the character's position.
How can this be improved?
The second part of the dev log series has been published: click here to read the full version.
I've added a few more lines of code on top of the script from part 1.
class Game_CharacterBase include TH:
ixel_Movement def map_passable?(x, y, d) delta = Tiles_Per_Step * 2 x_lo = x + delta y_lo = y + delta x_hi = x + 1 - delta y_hi = y + 1 - delta return false unless $game_map.passable?(x_lo, y_lo, d) return false unless $game_map.passable?(x_lo, y_hi, d) return false unless $game_map.passable?(x_hi, y_lo, d) return false unless $game_map.passable?(x_hi, y_hi, d) return true endendResults?
class Game_CharacterBase include TH:
Last edited by a moderator:

