simple slope's! :(

Status
Not open for further replies.

Des

timefantasy.net
Veteran
Joined
Mar 2, 2012
Messages
1,371
Reaction score
510
First Language
American
Primarily Uses
N/A
okay so lets start with an image of what i am trying to do!! :)



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!!! :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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?
 
Last edited by a moderator:

Des

timefantasy.net
Veteran
Joined
Mar 2, 2012
Messages
1,371
Reaction score
510
First Language
American
Primarily Uses
N/A
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. :)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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?
 

Des

timefantasy.net
Veteran
Joined
Mar 2, 2012
Messages
1,371
Reaction score
510
First Language
American
Primarily Uses
N/A
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.

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.
 
Last edited by a moderator:

Des

timefantasy.net
Veteran
Joined
Mar 2, 2012
Messages
1,371
Reaction score
510
First Language
American
Primarily Uses
N/A
sweet! that works perfectly. thanks so much shaz  BD   :thumbsup-right:
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top