Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Ruch w 8 kierunkach
Autor Wiadomość
Ozzma 




Preferowany:
RPG Maker VX

Pomogła: 1 raz
Dołączyła: 26 Wrz 2009
Posty: 88
Skąd: Stumilowy Las
Wysłany: Sro 28 Paź, 2009 09:08
Ruch w 8 kierunkach
Cześć Ultimowicze

Dzisiaj skrypt, który umożliwia poruszanie się bohatera, nie jak dotychczas w 4 kierunkach a w ośmiu. Do standardowych prawa, lewa, góry i dołu dochodzą skosy. Skrypt ten w oryginale został znaleziony na jednej z japońskich stron. Ja go jedynie lekko uprościłam.

Ruch w 8 kierunkach VX

Spoiler:

Kod:
# Skrypt by KGC edited by Ozzma
# www.ultimateam.pl

module KGC
 module Dash_8DirMove
  # 8 kierunkowe chodzenie true/false
  ENABLE_8DIR = true
 
  # 8 klatkowa animacja true/false
  ENABLE_8DIR_ANIMATION = true

  # Szybkość chodzenia
  DEFAULT_WALK_SPEED = 4
 
  # Szybkość podejścia
  DASH_SPEED_RATE    = 3
 end
end
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
$imported = {} if $imported == nil
$imported["Dash_8DirMove"] = true

module KGC::Dash_8DirMove
 
  SLANT_SUFFIX = "#"
end

module KGC
 module Commands
  module_function
 
  def reset_walk_speed
    $game_player.reset_move_speed
  end
 
  def set_walk_speed(value)
    $game_system.temp_walk_speed = value
  end
 
  def set_dash_speed(value)
    $game_system.temp_dash_speed = value
  end
 end
end

class Game_Interpreter
  include KGC::Commands
end

class Game_System
 
  attr_accessor :temp_dash_speed         
  attr_accessor :temp_walk_speed         
 
  alias initialize_KGC_Dash_8DirMove initialize
  def initialize
    initialize_KGC_Dash_8DirMove
    @temp_dash_speed = nil
    @temp_walk_speed = nil
  end 
end
# www.ultimateam.pl
class Game_Party < Game_Unit
 
  def decrease_steps
    @steps -= 1
  end
end

class Game_Character
 
  def direction_8dir
    return @direction
  end
 
  alias set_direction_KGC_Dash_8DirMove set_direction
  def set_direction(direction)
    last_dir = @direction

    set_direction_KGC_Dash_8DirMove(direction)

    if !@direction_fix && direction != 0
      @direction_8dir = direction
    end
  end
 
  alias move_lower_left_KGC_Dash_8DirMove move_lower_left
  def move_lower_left
    move_lower_left_KGC_Dash_8DirMove

    @direction_8dir = 1 unless @direction_fix
  end
 
  alias move_lower_right_KGC_Dash_8DirMove move_lower_right
  def move_lower_right
    move_lower_right_KGC_Dash_8DirMove

    @direction_8dir = 3 unless @direction_fix
  end
 
  alias move_upper_left_KGC_Dash_8DirMove move_upper_left
  def move_upper_left
    move_upper_left_KGC_Dash_8DirMove

    @direction_8dir = 7 unless @direction_fix
  end
 
  alias move_upper_right_KGC_Dash_8DirMove move_upper_right
  def move_upper_right
    move_upper_right_KGC_Dash_8DirMove

    @direction_8dir = 9 unless @direction_fix
  end
end

class Game_Player < Game_Character
 
  alias initialize_KGC_Dash_8DirMove initialize
  def initialize
    initialize_KGC_Dash_8DirMove

    reset_move_speed
  end
 
  def direction_8dir
    @direction_8dir = @direction if @direction_8dir == nil
    return @direction_8dir
  end
 
  def reset_move_speed
    @move_speed = KGC::Dash_8DirMove::DEFAULT_WALK_SPEED
  end
# www.ultimateam.pl
if KGC::Dash_8DirMove::ENABLE_8DIR
 
  def move_by_input
    return unless movable?
    return if $game_map.interpreter.running?

    if @reserved_move != nil
      case @reserved_move
      when :down
        move_down if passable_l?(2)
      when :left
        move_left if passable_l?(4)
      when :right
        move_right if passable_l?(6)
      when :up
        move_up if passable_l?(8)
      end
      @reserved_move = nil
      return
    end

    last_steps = $game_party.steps

    case Input.dir8
    when 1
      if !passable_l?(2) && passable_l?(4)
       
        move_left
        @reserved_move = :down
      elsif passable_l?(2) && !passable_l?(4)
       
        move_down
        @reserved_move = :left
      elsif passable_l?(2)
       
        move_down
        move_left
      end
      @direction = 2
    when 2
      move_down
    when 3
      if !passable_l?(2) && passable_l?(6)
       
        move_right
        @reserved_move = :down
      elsif passable_l?(2) && !passable_l?(6)
       
        move_down
        @reserved_move = :right
      elsif passable_l?(2)
       
        move_down
        move_right
      end
      @direction = 6
    when 4
      move_left
    when 6
      move_right
    when 7
      if !passable_l?(8) && passable_l?(4)
       
        move_left
        @reserved_move = :up
      elsif passable_l?(8) && !passable_l?(4)
       
        move_up
        @reserved_move = :left
      elsif passable_l?(8)
       
        move_up
        move_left
      end
      @direction = 4
    when 8
      move_up
    when 9
      if !passable_l?(8) && passable_l?(6)
       
        move_right
        @reserved_move = :up
      elsif passable_l?(8) && !passable_l?(6)
       
        move_up
        @reserved_move = :right
      elsif passable_l?(8)
       
        move_up
        move_right
      end
      @direction = 8
    else
      return
    end
    @direction_8dir = Input.dir8

    if $game_party.steps - last_steps == 2
      $game_party.decrease_steps
    end
  end

  def passable_l?(d)
    if $imported["TilesetExtension"]
      return passable?(@x, @y, d)
    else
      case d
      when 1
        return passable?(@x-1, @y+1)
      when 2
        return passable?(@x, @y+1)
      when 3
        return passable?(@x+1, @y+1)
      when 4
        return passable?(@x-1, @y)
      when 6
        return passable?(@x+1, @y)
      when 7
        return passable?(@x-1, @y-1)
      when 8
        return passable?(@x, @y-1)
      when 9
        return passable?(@x+1, @y-1)
      end
    end
    return false
  end
end 

  def update_move
    distance = 2 ** @move_speed   
    if dash?                     
      distance *= KGC::Dash_8DirMove::DASH_SPEED_RATE
     
      if $game_system.temp_dash_speed == nil
        @move_speed = KGC::Dash_8DirMove::DASH_SPEED_RATE
      else
        @move_speed = $game_system.temp_dash_speed
      end
    else
      if $game_system.temp_walk_speed == nil
         @move_speed = KGC::Dash_8DirMove::DEFAULT_WALK_SPEED
      else
         @move_speed = $game_system.temp_walk_speed
       end
     
    end
    distance = Integer(distance)

    @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
    @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
    @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
    @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
    update_bush_depth unless moving?
    if @walk_anime
      @anime_count += 1.5
    elsif @step_anime
      @anime_count += 1
    end
  end
end

if KGC::Dash_8DirMove::ENABLE_8DIR_ANIMATION

class Sprite_Character < Sprite_Base
 
  SLANT_ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
 
  alias update_bitmap_KGC_Dash_8DirMove update_bitmap
  def update_bitmap
    name_changed = (@character_name != @character.character_name)

    update_bitmap_KGC_Dash_8DirMove

    if @tile_id > 0             
      @enable_slant = false
      return
    end
    return unless name_changed

    @enable_slant = true
    begin
      @character_name_slant = @character_name + KGC::Dash_8DirMove::SLANT_SUFFIX
      Cache.character(@character_name_slant)
    rescue
      @enable_slant = false
    end
  end
 
  alias update_src_rect_KGC_Dash_8DirMove update_src_rect
  def update_src_rect
    return if @tile_id > 0

    if @enable_slant
      update_src_rect_for_slant
    else
      update_src_rect_KGC_Dash_8DirMove
    end
  end
 
  def update_src_rect_for_slant
    index = @character.character_index
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw

    dir = @character.direction_8dir
    case dir % 2
    when 0 
      if @last_slant
        self.bitmap = Cache.character(@character_name)
        @last_slant = false
      end
    else   
      unless @last_slant
        self.bitmap = Cache.character(@character_name_slant)
        @last_slant = true
      end
     
      dir = SLANT_ANIME_TABLE[dir]
    end

    sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end
end 
# www.ultimateam.pl



:cmok:

8_kierunków.txt
Pobierz SKRYPT
Pobierz Plik ściągnięto 552 raz(y) 8,07 KB

________________________
Ostatnio zmieniony przez Ayene Sro 18 Lis, 2009 07:34, w całości zmieniany 1 raz  
 
 
Cyklop 




Nagrody:
UFT3 Winner

Ranga RM:
1 gra

Dołączył: 03 Sie 2008
Posty: 54
Skąd: ???
Wysłany: Pią 30 Paź, 2009 14:05
Fajne, dużo lepiej chodzi się po mapie. Przydałby się jeszcze jakiś char z różnymi kierunkami żeby widać było że idzie na ukos. Ale skrypcik konkretny i nie kłóci się z tymi 10 co mam do tej pory :PP
 
 
Sarc 



Preferowany:
RPG Maker VX

Dołączył: 09 Lis 2009
Posty: 13
Wysłany: Pon 09 Lis, 2009 20:10
Niewygodnie się tym porusza...
________________________
 
 
Cyklop 




Nagrody:
UFT3 Winner

Ranga RM:
1 gra

Dołączył: 03 Sie 2008
Posty: 54
Skąd: ???
Wysłany: Czw 12 Lis, 2009 12:15
Bo to skrypt dla masochistów, dla tych którzy kochają niewygodę :P:P Mi się podoba x2 :D
 
 
CreeperCrisis 



Preferowany:
RPG Maker VXAce

Pomógł: 32 razy
Dołączył: 01 Maj 2010
Posty: 395
Wysłany: Pon 14 Cze, 2010 19:42
Mam pytanko (również odświeżę temat :mrgreen: ) mam specjalny rysunek do chodzenia na ukos:

Co mam zrobić, aby zadziałał. :-)
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Pon 14 Cze, 2010 19:48
Nazwij chara imieniem postaci i dodaj do nazwy znak '#'
________________________


 
 
 
CreeperCrisis 



Preferowany:
RPG Maker VXAce

Pomógł: 32 razy
Dołączył: 01 Maj 2010
Posty: 395
Wysłany: Pon 14 Cze, 2010 19:50
a imieniem postaci czy obrazka bo dałem nazwę postaci i dalej chodzi tak samo napisałem "#edinus"
 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Pon 14 Cze, 2010 20:17
Najpierw nazwa postaci, dopiero później #, czyli 'edinus#'
________________________


 
 
 
Amelanduil 




Preferowany:
RPG Maker VXAce

Pomógł: 3 razy
Dołączył: 28 Wrz 2011
Posty: 464
Wysłany: Wto 10 Sie, 2010 15:28
CC, widzę, że masz battlery z kaduki :D
Skrypt dobry, użyłbym go, chociaż wtedy do kilku postaci musiałbym dodać charset, co dałoby łącznie 4 charsety na jedną postać... ale to nie problem, bardziej przeszkadza to, że faktycznie jakoś dziwnie się porusza + postać może poruszać się tam, gdzie normalnie nie mogłaby (utrudnia pracę mapmakerowi :D)
________________________
(╯°□°)╯︵ ┻━┻
"A jeśli... Boga nie ma, to co z ciebie za szatan?"
 
 
 
bartek2940 




Preferowany:
RPG Maker VX

Pomógł: 1 raz
Dołączył: 10 Kwi 2010
Posty: 88
Wysłany: Pon 18 Paź, 2010 16:08
Znalazłem ukosy wielu oryginalnych postaci.
Tu macie zapisujcie sobie, a do łączenia jest nawet program do znalezienia na forum lub w googlach.

Strona z ukosami:
Ukosy
________________________
Obecny projekt - Chwilowo brak
 
 
 
Itaki 




Preferowany:
RPG Maker VX

Ranga RM:
1 gra

Pomógł: 8 razy
Dołączył: 07 Maj 2010
Posty: 278
Skąd: z Arvorii.
Wysłany: Pon 18 Paź, 2010 18:12
Może się przyda :-)
________________________
Proponuje:

http://r9.fodey.com/2141/...37ef9c849.0.gif
http://grawbank.tk/959/dajcie_na_piwo
http://grawbank.tk/797/daj_dla_biedacka_ < tu musisz wcisnąć!



SIEMANO Gość
 
 
 
matijoe 



Preferowany:
RPG Maker VX

Dołączył: 28 Gru 2010
Posty: 11
Skąd: spróbuj ponownie
Wysłany: Czw 30 Gru, 2010 11:07
fajny skrypt potrzeba więcej takich skryptów
________________________
http://www.wolin.fora.pl/-zarejestruj się a bardzo mi pomorzesz
jestem w Menelgame
 
 
KrystianBoss 



Dołączył: 12 Lut 2011
Posty: 4
Wysłany: Sob 12 Lut, 2011 21:48
Cześć czy mugłby mi ktoś wytłumaczyć jak to dodać bo dodaje i mam kupe błedów ja mam to całe zkopiować i wkleić nad mein ???
i jaką dać tego nazwę
 
 
Shlizer 




Preferowany:
RPG Maker XP

Pomógł: 11 razy
Dołączył: 02 Sty 2011
Posty: 138
Skąd: /var/tmp
Wysłany: Sob 12 Lut, 2011 21:57
@up to jakaś podpucha prawda?

generalnie jeśli rozumujesz tak, jak piszesz to zacznij od słownika j. polskiego.. (tłumacząc po Twojemu: kupe zrozumisz a muglbys sie czegoz nauczyc)

Wklej nad Main, a nie nad mein.
________________________
Aversum Framework Demo
Aktualnie pracuję nad NSO =p
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene