simple slope's! :(

● ARCHIVED · READ-ONLY
Started by Des 8 posts View original ↗
  1. okay so lets start with an image of what i am trying to do!! :)

    1Zusu.png

    basically, I'd like slopes like this to work easily and smoothly. whenever the player is on a tile marked with a region, his horizontal movement becomes diagonal.

    the difficulty that I have eventing is that the movement isn't fluid. the player should be able to just walk on these normally and uninterrupted.

    a good scripter could probably pump this out pretty quickly. much appreciated!!! :)
  2. You want the player to just be able to hold down the right or left button, and the script will detect the slope and override the straight movement to diagonal movement accordingly?


    Would it be easier to use terrain tags on the tiles that slope up/down rather than painting them manually on every map where they're used?


    And would there be a case where the player is moving up or down and encounters a slope, or would they only be going left or right?
  3. Shaz said:
    You want the player to just be able to hold down the right or left button, and the script will detect the slope and override the straight movement to diagonal movement accordingly?

    Would it be easier to use terrain tags on the tiles that slope up/down rather than painting them manually on every map where they're used?
    yes. basically the player should be able to walk up and down them just by holding the regular arrow keys without any interruption of his walking.

    and sure—that's probably easier. the region was a way of illustrating the idea, but the cleaner the solution the better. :)
  4. Would it only apply to horizontal movement? Can you think of a situation where you'd be walking up or down and bump into one of these tiles?
  5. Shaz said:
    Would it only apply to horizontal movement? Can you think of a situation where you'd be walking up or down and bump into one of these tiles?
    don't think so. the idea is that it's a side-scrolling rpg. whenever the player would be using "up" or "down" would be climbing ladders or entering doors.
  6. haha - that's very cool :D Only left/right movement implemented. Let me know if you bump into something that requires up/down transition to slopes.

    Okay, the following lets you use either terrain tags or region ids to indicate tiles where you should move up or down when going from left to right (and of course, the reverse when going in the opposite direction). Set the 3 constants at the top of the script appropriately.

    This handles the player, followers, and events. If you have events that fly, they will also be affected by this, even though they probably shouldn't be.

    Spoiler
    TERRAIN_LOOKUP = false # true for terrain tags, false for region idsUPLR = 62 # terrain or region to go up when moving right DOWNLR = 63 # terrain or region to go down when moving rightclass Game_CharacterBase #-------------------------------------------------------------------------- # * Method aliases #-------------------------------------------------------------------------- alias shaz_sdm_move_straight move_straight #-------------------------------------------------------------------------- # * Diagonal Override # d: Direction (2,4,6,8) #-------------------------------------------------------------------------- def diagonal_override(d) this_override = TERRAIN_LOOKUP ? $game_map.terrain_tag(@x, @y) : $game_map.region_id(@x, @y) new_x = $game_map.round_x_with_direction(@x, d) new_y = $game_map.round_y_with_direction(@y, d) new_override = TERRAIN_LOOKUP ? $game_map.terrain_tag(new_x, new_y) : $game_map.region_id(new_x, new_y) if (new_override == UPLR && d == 6) return 6, 8 elsif (new_override == DOWNLR && d == 4) return 4, 8 elsif (this_override == UPLR && d == 4) return 4, 2 elsif (this_override == DOWNLR && d == 6) return 6, 2 else return 0, 0 end end #-------------------------------------------------------------------------- # * Move Straight # d: Direction (2,4,6,8) # turn_ok : Allows change of direction on the spot #-------------------------------------------------------------------------- def move_straight(d, turn_ok = true) ovh, ovv = diagonal_override(d) if ovh != 0 && ovv != 0 move_diagonal(ovh, ovv) else shaz_sdm_move_straight(d, turn_ok) end endend
    This should be placed below any other script that overrides or replaces the Game_CharacterBase.move_straight method.
  7. sweet! that works perfectly. thanks so much shaz  BD   :thumbsup-right:
  8. You're welcome :)


    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.