Allora... mi scuso per questo topic, ho visto che ve ne sono milioni gia aperti nel forum XD ma a nessuno è stata data una risposta... tutti broken-link... script che fan crashare i giochi, tutta roba inconcludente...
ora... è assurdo che non si trovi neanche uno script decente per la grafica ad 8 direzioni O_O generalmente è uno degli script che gli utenti vanno a cercare più frequentemente...
Ho girato su 4-5 siti di making... e non ho trovato assolutamente niente, ho cercato qui, con le parole chiave "isometrico", "direzioni" stesse parole chiave (in inglese) ho usato negli altri siti... ma non si trova assolutamente niente di funzionante, a me sa incredibile XD
O meglio... A dire il vero uno l'ho trovato XD però imposta le 8 direzioni a tutti gli eventi, non solo per il protagonista, e questo mi crea numerosissimi problemi, visto che lo devo attivare solo occasionalmente...
La mia domanda quindi è:
Esiste o no uno script per grafica 8-direzionale che influisce solo sul protagonista? (Non pensavo avrei incontrato tanti problemi per trovarne uno)
#============================================================================# * 8 Directional Movement in RPG Maker XP#----------------------------------------------------------------------------# by MegatotsuRPG# Date created: 01.05.08# Last Update: 01.05.08#----------------------------------------------------------------------------# This script provides 8 directional movement, instead of the cruddy# default movement system. #----------------------------------------------------------------------------## Instructions ## You can disable the player's movement with this: # "$movedisabled = true" . Make sure to remove the double quotes, though.## Also, the charsets have to be in the following format:# 1 Lower_left# 2 Down# 3 Lower_right# 4 Left# 5 Right# 6 Upper_left# 7 Up# 8 Upper_right#----------------------------------------------------------------------------## Credits and Thanks## A big thank you and kiss to Blizzard, because I figured out# how to do this from his ABS.# Thanks to Draycos Goldaryn, because I used part of his edit# to sprite_character, and the 8-directional charset from his advanced player# movement :p .### Now on to the script!#============================================================================ class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Frame Update (Updated for axial movement) #-------------------------------------------------------------------------- def update # Remember whether or not moving in local variables last_moving = moving? # If moving, event running, move route forcing, and message window # display are all not occurring unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing or $movedisabled 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 # Remember coordinates in local variables last_real_x = @real_x last_real_y = @real_y super # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # Scroll map down $game_map.scroll_down(@real_y - last_real_y) end # If character moves left and is positioned more let on-screen than # center if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # Scroll map left $game_map.scroll_left(last_real_x - @real_x) end # If character moves right and is positioned more right on-screen than # center if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # Scroll map right $game_map.scroll_right(@real_x - last_real_x) end # If character moves up and is positioned higher than the center # of the screen if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # Scroll map up $game_map.scroll_up(last_real_y - @real_y) end # If not moving unless moving? # If player was moving last time if last_moving # Event determinant is via touch of same position event result = check_event_trigger_here([1,2]) # If event which started does not exist if result == false # Disregard if debug mode is ON and ctrl key was pressed unless $DEBUG and Input.press?(Input::CTRL) # Encounter countdown if @encounter_count > 0 @encounter_count -= 1 end end end end # If C button was pressed if Input.trigger?(Input::C) # Same position and front event determinant check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end endend class Game_Character #-------------------------------------------------------------------------- # * Move Lower Left #-------------------------------------------------------------------------- def move_lower_left(turn_enabled = true) # Turn up if turn_enabled turn_lower_left end # When a down to left or a left to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2)) # Update coordinates @x -= 1 @y += 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x-1, @y+1) end end #-------------------------------------------------------------------------- # * Move Lower Right #-------------------------------------------------------------------------- def move_lower_right(turn_enabled = true) # Turn up if turn_enabled turn_lower_right end # When a down to right or a right to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2)) # Update coordinates @x += 1 @y += 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x+1, @y+1) end end #-------------------------------------------------------------------------- # * Move Upper Left #-------------------------------------------------------------------------- def move_upper_left(turn_enabled = true) # Turn up if turn_enabled turn_upper_left end # When an up to left or a left to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8)) # Update coordinates @x -= 1 @y -= 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x-1, @y-1) end end #-------------------------------------------------------------------------- # * Move Upper Right #-------------------------------------------------------------------------- def move_upper_right(turn_enabled = true) # Turn up if turn_enabled turn_upper_right end # When an up to right or a right to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8)) # Update coordinates @x += 1 @y -= 1 # Increase steps increase_steps # If impassable else # Determine if touch event is triggered check_event_trigger_touch(@x+1, @y-1) end end #-------------------------------------------------------------------------- # * Move at Random #-------------------------------------------------------------------------- def move_random case rand(8) when 0 # Move down move_down when 1 # Move left move_left when 2 # Move right move_right when 3 # Move up move_up when 4 move_lower_left when 5 move_lower_right when 6 move_upper_left when 7 move_upper_right end end #-------------------------------------------------------------------------- # * Move toward Player #-------------------------------------------------------------------------- def move_toward_player # Get difference in player coordinates sx = @x - $game_player.x sy = @y - $game_player.y # If coordinates are equal if sx == 0 and sy == 0 return end # Get absolute value of difference abs_sx = sx.abs abs_sy = sy.abs #get diagonal differences sh = (abs_sx / 2) - abs_sy sv = (abs_sy / 2) - abs_sx # Is the player more towards a 45? angle? if abs_sx == abs_sy || (sv < 0 and sh < 0) if $game_player.y > @y #if the player is lower left if $game_player.x < @x move_lower_left #If the player is lower right else move_lower_right end else #if the player is upper left if $game_player.x < @x move_upper_left #if the player is upper right else move_upper_right end end # If horizontal distance is longer elsif abs_sx > abs_sy # Move towards player, prioritize left and right directions sx > 0 ? move_left : move_right if not moving? and sy != 0 sy > 0 ? move_up : move_down end # If vertical distance is longer else # Move towards player, prioritize up and down directions sy > 0 ? move_up : move_down if not moving? and sx != 0 sx > 0 ? move_left : move_right end end end #-------------------------------------------------------------------------- # * Move away from Player #-------------------------------------------------------------------------- def move_away_from_player # Get difference in player coordinates sx = @x - $game_player.x sy = @y - $game_player.y # If coordinates are equal if sx == 0 and sy == 0 return end # Get absolute value of difference abs_sx = sx.abs abs_sy = sy.abs #get diagonal differences sh = (abs_sx / 2) - abs_sy sv = (abs_sy / 2) - abs_sx # Is the player more towards a 45? angle? if abs_sx == abs_sy || (sv < 0 and sh < 0) if $game_player.y > @y #if the player is lower left if $game_player.x < @x move_upper_right #If the player is lower right else move_upper_left end else #if the player is upper left if $game_player.x < @x move_lower_right #if the player is upper right else move_lower_left end end # If horizontal distance is longer elsif abs_sx > abs_sy # Move away from player, prioritize left and right directions sx > 0 ? move_right : move_left if not moving? and sy != 0 sy > 0 ? move_down : move_up end # If vertical distance is longer else # Move away from player, prioritize up and down directions sy > 0 ? move_down : move_up if not moving? and sx != 0 sx > 0 ? move_right : move_left end end end #-------------------------------------------------------------------------- # * 1 Step Forward #-------------------------------------------------------------------------- def move_forward case @direction when 2 move_down(false) when 4 move_left(false) when 6 move_right(false) when 8 move_up(false) when 1 #lower left move_lower_left(false) when 3 #lower right move_lower_right(false) when 7 #upper left move_upper_left(false) when 9 #upper right move_upper_right(false) end end #-------------------------------------------------------------------------- # * 1 Step Backward #-------------------------------------------------------------------------- def move_backward # Remember direction fix situation last_direction_fix = @direction_fix # Force directino fix @direction_fix = true # Branch by direction case @direction when 2 # Down move_up(false) when 4 # Left move_right(false) when 6 # Right move_left(false) when 8 # Up move_down(false) when 1 #lower left move_upper_right(false) when 3 #lower right move_upper_left(false) when 7 #upper left move_lower_right(false) when 9 #upper right move_lower_left(false) end # Return direction fix situation back to normal @direction_fix = last_direction_fix end #-------------------------------------------------------------------------- # * Jump # x_plus : x-coordinate plus value # y_plus : y-coordinate plus value #-------------------------------------------------------------------------- def jump(x_plus, y_plus) # If plus value is not (0,0) if x_plus != 0 or y_plus != 0 # If horizontal distnace is longer if x_plus.abs > y_plus.abs # Change direction to left or right x_plus < 0 ? turn_left : turn_right # If vertical distance is longer elsif x_plus.abs < y_plus.abs # Change direction to up or down y_plus < 0 ? turn_up : turn_down # if distances are equal else if x_plus < 0 if y_plus < 0 turn_upper_left else turn_lower_left end else if y_plus < 0 turn_upper_right else turn_lower_right end end end end # Calculate new coordinates new_x = @x + x_plus new_y = @y + y_plus # If plus value is (0,0) or jump destination is passable if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0) # Straighten position straighten # Update coordinates @x = new_x @y = new_y # Calculate distance distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round # Set jump count @jump_peak = 10 + distance - @move_speed @jump_count = @jump_peak * 2 # Clear stop count @stop_count = 0 end end #-------------------------------------------------------------------------- # * Turn Lower Left #-------------------------------------------------------------------------- def turn_lower_left unless @direction_fix @direction = 1 @stop_count = 0 end end #-------------------------------------------------------------------------- # * Turn Lower Right #-------------------------------------------------------------------------- def turn_lower_right unless @direction_fix @direction = 3 @stop_count = 0 end end #-------------------------------------------------------------------------- # * Turn Upper Left #-------------------------------------------------------------------------- def turn_upper_left unless @direction_fix @direction = 7 @stop_count = 0 end end #-------------------------------------------------------------------------- # * Turn Upper Right #-------------------------------------------------------------------------- def turn_upper_right unless @direction_fix @direction = 9 @stop_count = 0 end end #-------------------------------------------------------------------------- # * Turn 90? Right #-------------------------------------------------------------------------- def turn_right_90 case @direction when 2 turn_left when 4 turn_up when 6 turn_down when 8 turn_right when 1 turn_upper_left when 3 turn_lower_left when 7 turn_upper_right when 9 turn_lower_right end end #-------------------------------------------------------------------------- # * Turn 90? Left #-------------------------------------------------------------------------- def turn_left_90 case @direction when 2 turn_right when 4 turn_down when 6 turn_up when 8 turn_left when 1 turn_upper_right when 3 turn_upper_left when 7 turn_lower_right when 9 turn_lower_left end end #-------------------------------------------------------------------------- # * Turn 180? #-------------------------------------------------------------------------- def turn_180 case @direction when 2 turn_up when 4 turn_right when 6 turn_left when 8 turn_down when 1 turn_upper_left when 3 turn_lower_left when 7 turn_upper_right when 9 turn_lower_right end end #-------------------------------------------------------------------------- # * Turn 90? Right or Left #-------------------------------------------------------------------------- def turn_right_or_left_90 if rand(2) == 0 turn_right_90 else turn_left_90 end end #-------------------------------------------------------------------------- # * Turn at Random #-------------------------------------------------------------------------- def turn_random case rand(8) when 0 turn_up when 1 turn_right when 2 turn_left when 3 turn_down when 4 turn_lower_left when 5 turn_lower_right when 6 turn_upper_left when 7 turn_upper_right end end #-------------------------------------------------------------------------- # * Turn 45? Right #-------------------------------------------------------------------------- def turn_45_right case @direction when 2 turn_lower_left when 4 turn_upper_left when 6 turn_lower_right when 8 turn_upper_right when 1 turn_left when 3 turn_down when 7 turn_up when 9 turn_right end end #-------------------------------------------------------------------------- # * Turn 45? Left #-------------------------------------------------------------------------- def turn_45_left case @direction when 2 turn_lower_right when 4 turn_lower_left when 6 turn_upper_right when 8 turn_upper_left when 1 turn_down when 3 turn_right when 7 turn_left when 9 turn_up end end #-------------------------------------------------------------------------- # * Turn 45? Right or Left #-------------------------------------------------------------------------- def turn_45_right_or_left if rand(2) == 0 turn_right_45 else turn_left_45 end end #-------------------------------------------------------------------------- # * Turn Forward Right #-------------------------------------------------------------------------- def turn_forward_right turn_45_right move_forward end #-------------------------------------------------------------------------- # * Turn Forward Left #-------------------------------------------------------------------------- def turn_forward_left turn_45_left move_forward end #-------------------------------------------------------------------------- # * Turn Backward Right #-------------------------------------------------------------------------- def turn_backward_right turn_45_right move_backward end #-------------------------------------------------------------------------- # * Turn Backward Left #-------------------------------------------------------------------------- def turn_backward_left turn_45_left move_backward end #-------------------------------------------------------------------------- # * Turn Towards Player #-------------------------------------------------------------------------- def turn_toward_player # Get difference in player coordinates sx = @x - $game_player.x sy = @y - $game_player.y # If coordinates are equal if sx == 0 and sy == 0 return end # Get absolute value of difference abs_sx = sx.abs abs_sy = sy.abs #get diagonal differences sh = (abs_sx / 2) - abs_sy sv = (abs_sy / 2) - abs_sx # If the diagonal distance is equal if (sh == 0 or sv == 0) && ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1)) return end # Is the player more towards a 45? angle? if abs_sx == abs_sy || (sv < 0 and sh < 0) if $game_player.y > @y #if the player is lower left if $game_player.x < @x turn_lower_left #If the player is lower right else turn_lower_right end else #if the player is upper left if $game_player.x < @x turn_upper_left #if the player is upper right else turn_upper_right end end # If horizontal distance is longer elsif abs_sx > abs_sy # Turn to the right or left toward player sx > 0 ? turn_left : turn_right # If vertical distance is longer else # Turn up or down toward player sy > 0 ? turn_up : turn_down end end #-------------------------------------------------------------------------- # * Turn Away from Player #-------------------------------------------------------------------------- def turn_away_from_player # Get difference in player coordinates sx = @x - $game_player.x sy = @y - $game_player.y # If coordinates are equal if sx == 0 and sy == 0 return end # Get absolute value of difference abs_sx = sx.abs abs_sy = sy.abs #get diagonal differences sh = (abs_sx / 2) - abs_sy sv = (abs_sy / 2) - abs_sx # If the diagonal distance is equal if (sh == 0 or sv == 0) && ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1)) return end # Is the player more towards a 45? angle? if abs_sx == abs_sy || (sv < 0 and sh < 0) if $game_player.y > @y #if the player is lower left if $game_player.x < @x turn_upper_right #If the player is lower right else turn_upper_left end else #if the player is upper left if $game_player.x < @x turn_lower_right #if the player is upper right else turn_lower_left end end # If horizontal distance is longer elsif abs_sx > abs_sy # Turn to the right or left away from player sx > 0 ? turn_right : turn_left # If vertical distance is longer else # Turn up or down away from player sy > 0 ? turn_down : turn_up end endend class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- # * Frame Update (edited) #-------------------------------------------------------------------------- def update super # If tile ID, file name, or hue are different from current ones if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue # Remember tile ID, file name, and hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue # If tile ID value is valid if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 # If tile ID value is invalid else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 4 @ch = bitmap.height / 8 self.ox = @cw / 2 self.oy = @ch end end # Set visible situation self.visible = (not @character.transparent) # If graphic is character if @tile_id == 0 # Set rectangular transfer sx = @character.pattern * @cw if @character.direction >= 6 sy = (@character.direction - 2 ) * @ch else sy = (@character.direction - 1 ) * @ch end self.src_rect.set(sx, sy, @cw, @ch) end # Set sprite coordinates self.x = @character.screen_x self.y = @character.screen_y self.z = @character.screen_z(@ch) # Set opacity level, blend method, and bush depth self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth # Animation if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end endend
Forse è possibile modificare questo per far si che influisca solo sul protagonista... non so...
eventualmente farà comodo a chi cerca uno script per le 8 direzioni... Spero fortemente che sia possibile trovarne uno funzionante XD
Question
FenriX`
Allora... mi scuso per questo topic, ho visto che ve ne sono milioni gia aperti nel forum XD ma a nessuno è stata data una risposta... tutti broken-link... script che fan crashare i giochi, tutta roba inconcludente...
ora... è assurdo che non si trovi neanche uno script decente per la grafica ad 8 direzioni O_O generalmente è uno degli script che gli utenti vanno a cercare più frequentemente...
Ho girato su 4-5 siti di making... e non ho trovato assolutamente niente, ho cercato qui, con le parole chiave "isometrico", "direzioni" stesse parole chiave (in inglese) ho usato negli altri siti... ma non si trova assolutamente niente di funzionante, a me sa incredibile XD
O meglio... A dire il vero uno l'ho trovato XD però imposta le 8 direzioni a tutti gli eventi, non solo per il protagonista, e questo mi crea numerosissimi problemi, visto che lo devo attivare solo occasionalmente...
La mia domanda quindi è:
Esiste o no uno script per grafica 8-direzionale che influisce solo sul protagonista? (Non pensavo avrei incontrato tanti problemi per trovarne uno)
Forse è possibile modificare questo per far si che influisca solo sul protagonista... non so...
eventualmente farà comodo a chi cerca uno script per le 8 direzioni... Spero fortemente che sia possibile trovarne uno funzionante XD
Edited by FenriX`«NEWS!!» http://img123.imageshack.us/img123/24/89057157.png
http://img115.imageshack.us/img115/5350/19481487.png
http://img407.imageshack.us/img407/2696/45573607.png
http://img185.imageshack.us/img185/373/70775921.png
Membro # 8-8-8 [Hachi] della:
http://img3.imageshack.us/img3/9636/bannergm.png
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now