RPGVX.net

  RPG-Maker VX => VX Technik [Frageforum] => Thema gestartet von: duinger am April 18, 2010, 10:59:49

Titel: Maps in einer 30 Grad Drehung?
Beitrag von: duinger am April 18, 2010, 10:59:49
Hallo.

Ich wollte Fragen ob es Möglich ist die Maps im Spiel um 30% zu Drehen.
Ich habe leider nur dieses Beispiel gefunden:
(http://www.siliconera.com/wordpress/wp-content/uploads/2007/07/ffta2.jpg)

Dankeschön für eure Antwort.
Titel: Re: Maps in einer 30 Grad Drehung?
Beitrag von: Kyoshiro am April 18, 2010, 11:25:32
Du hast kein Beispiel mit eingefügt.
Was du aber sicherlich meinst ist eine ISO-Ansicht. Dafür bräuchtest du neue Tiles, weil das mit den normalen Grafiken nicht geht. Da müsstest du vll mal bei http://www.spriters-resource.com/ (http://www.spriters-resource.com/) gucken, ob du entsprechende Rips aus solchen Spielen findest.
Aber eine Möglichkeit per Script oder so aus den normalen Maps ISO-Maps zu machen geht nicht.

MkG
Kyoshiro
Titel: Re: Maps in einer 30 Grad Drehung?
Beitrag von: MicroJumper am April 29, 2010, 21:49:52
hmm...
hab hier zumindest schonmal ein Script, dass die Isometrischen bewegungen unterstützt...
siehs dir einfach mal an^^

hab den Link nimmer gefunden also hier (alle Scripts einzeln einfügen):

Isometric (Basic)
#==============================================================================
# ¦ Scene_Title
#==============================================================================
class Scene_Title
  alias main_orig main
  #--------------------------------------------------------------------------
  # ? Loads MapInfos so that Iso map id's can be loaded according to the current map.
  #--------------------------------------------------------------------------
  def main
    $data_map_info        = load_data("Data/MapInfos.rvdata")
    main_orig
  end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # * Identifies if map is designated for ISO views or not
  #--------------------------------------------------------------------------
  def iso?
    map = $data_map_info[@map_id]
    if map.name.include?("ISO")
      return map.parent_id
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Map Data
  #--------------------------------------------------------------------------
  def data
    return @iso_map.data if !@iso_map.nil?
    return @map.data
  end
  #--------------------------------------------------------------------------
  # * Get Width
  #--------------------------------------------------------------------------
  def iso_width
    #return @iso_map.width if !@iso_map.nil?
    return @iso_map.width
  end
  #--------------------------------------------------------------------------
  # * Get Height
  #--------------------------------------------------------------------------
  def iso_height
    return @iso_map.height
  end
 
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------
  alias iso_gmsetup setup
  def setup(map_id)
    @map_id = map_id
    if iso? == 0
      @iso_map = nil
      iso_gmsetup(map_id)
      return
    else
      @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
      @iso_map = load_data(sprintf("Data/Map%03d.rvdata", iso?))
    end
    @display_x = 0
    @display_y = 0
    @passages = $data_system.passages
    referesh_vehicles
    setup_events
    setup_scroll
    setup_parallax
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # * Scroll Down
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  alias iso_scdwn scroll_down
  def scroll_down(distance)
    if iso? == 0
      iso_scdwn(distance)
    else
      if loop_vertical?
        @display_y += distance
        @display_y %= @map.iso_height * 256
        @parallax_y += distance
      else
        last_y = @display_y
        corr = (($game_map.height + $game_map.width)%2 == 0 ? 0 : 4*16)
        @display_y = [@display_y + distance, ($game_map.iso_height - 13) * 256 - corr].min
        @parallax_y += @display_y - last_y
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Scroll Right
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  alias iso_scrght scroll_right
  def scroll_right(distance)
    if iso? == 0
      iso_scrght(distance)
    else
      if loop_horizontal?
        @display_x += distance
        @display_x %= @map.width * 256
        @parallax_x += distance
      else
        last_x = @display_x
        @display_x = [@display_x + distance, ($game_map.iso_width - 18) * 256].min
        @parallax_x += @display_x - last_x
      end
    end
  end
end

#==============================================================================
# ¦ Game_Character
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  # ? Update the position of the characters to the screen according to x,y in isometric
  #--------------------------------------------------------------------------
  alias gc_iso_scr_x screen_x
  def screen_x
    if $game_map.iso? == 0
      return gc_iso_scr_x
    else
      return ((@real_x - @real_y)/8 + (32 * $game_map.height) - 0 - $game_map.display_x/8) - 16
    end
  end
  #--------------------------------------------------------------------------
  alias gc_iso_scr_y screen_y
  def screen_y
    if $game_map.iso? == 0
      return gc_iso_scr_y
    else
      y = (@real_y + @real_x) / 16 + 24 - $game_map.display_y/8
      if @jump_count >= @jump_peak
        n = @jump_count - @jump_peak
      else
        n = @jump_peak - @jump_count
      end
      return y - (@jump_peak * @jump_peak - n * n) / 2
    end
  end
end

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Update Scroll
  #--------------------------------------------------------------------------
  alias gp_iso_upd_scl update_scroll
  def update_scroll(last_real_x, last_real_y)
    if $game_map.iso? == 0
      gp_iso_upd_scl(last_real_x, last_real_y)
    else
      disp_x = screen_x + $game_map.display_x/8
      disp_y = screen_y + $game_map.display_y/8
      if CENTER_Y - (8*disp_y - $game_map.display_y) > 0
        $game_map.scroll_up(CENTER_Y - (8*disp_y - $game_map.display_y))
      end
      if CENTER_Y - (8*disp_y - $game_map.display_y) < 0 
        $game_map.scroll_down(8*disp_y - $game_map.display_y - CENTER_Y)
      end
      if CENTER_X - (8*disp_x - $game_map.display_x) > 0
        $game_map.scroll_left(CENTER_X - (8*disp_x - $game_map.display_x))
      end
      if CENTER_X - (8*disp_x - $game_map.display_x) < 0
        $game_map.scroll_right(8*disp_x - $game_map.display_x - CENTER_X)
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Set Map Display Position to Center of Screen
  #     x : x-coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  alias gp_iso_ctr center
  def center(x, y)
    if $game_map.iso? == 0
      gp_iso_ctr(x, y)
    else
      update_scroll(@real_x, @real_y)
    end
  end
end

Isometric (Advance)
#==============================================================================
# ** Global variables
#==============================================================================

ISO_ENABLE_JUMP  = true  #Enable Jump while on maps?
MOVE_WHILE_JUMP  = true  #Enable Player to move while jumping?
CLIMBABLE_MOVE    = 2    #The height change that you can climb without jump (jumping can add up to 2)
DROPABLE_MOVE    = -4    #The height change that you can walk down (MUST be negative)

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :map                     # map screen state
end

#==============================================================================
# ? Game_Character
#==============================================================================
class Game_Character
 
  #--------------------------------------------------------------------------
  # ? Initialize
  #--------------------------------------------------------------------------
  alias gc_iso_init initialize
  def initialize
    @h = 0
    @th = 0
    gc_iso_init
  end
 
  #--------------------------------------------------------------------------
  # ? Screen_th : height of the ground
  #--------------------------------------------------------------------------
  def screen_th(x=self.x,y=self.y)
    tile_id = $game_map.map.data[x,y,0]
    return 0 if tile_id == nil
    if tile_id > 1623 and tile_id < 1664
      return tile_id-1624
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ? Screen_h : height of the character
  #--------------------------------------------------------------------------
  def screen_h
    return @h
  end
  #--------------------------------------------------------------------------
  # ? Update
  #--------------------------------------------------------------------------
  alias gc_iso_update update
  def update
    if $game_map.iso? == 0
      gc_iso_update update
    else
      if @h < screen_th
        @h += 1
      elsif @h > screen_th
        if !jumping?
          if (@h - screen_th) > 2
            @h -= [0.5 * 2, 1].min
          else
            @h -= 0.5
          end
        end
      end
      gc_iso_update
    end
  end
  #--------------------------------------------------------------------------
  # ? Update the position of the characters to the screen according to x,y in isometric
  #--------------------------------------------------------------------------
  alias gc2_iso_scr_y screen_y
  def screen_y
    if $game_map.iso? == 0
      return gc2_iso_scr_y
    else
      y = (@real_y + @real_x) / 16 + 24 - $game_map.display_y/8 - (@h * 8)
      if @jump_count >= @jump_peak
        n = @jump_count - @jump_peak
      else
        n = @jump_peak - @jump_count
      end
      return y - (@jump_peak * @jump_peak - n * n) / 2
    end
  end
  #--------------------------------------------------------------------------
  alias gc_iso_scr_z screen_z
  def screen_z
    if $game_map.iso? == 0
      return gc_iso_scr_z
    else
      return (gc_iso_scr_z + (self.screen_h * 64))
    end
  end
  #==============================================================================
  # ? Passabilities and interactions with events
  #==============================================================================
  alias gc_iso_passable? passable?
  def passable?(x, y)
    if $game_map.iso? == 0
      return gc_iso_passable?(x, y)
    end
    x = $game_map.round_x(x)                        # Horizontal loop adj.
    y = $game_map.round_y(y)                        # Vertical loop adj.
    return false unless $game_map.valid?(x, y)      # Outside map?
    return true if @through or debug_through?       # Through ON?
    return false unless map_passable?(x, y)         # Map Impassable?
    return false if collide_with_characters?(x, y)  # Collide with character?
   
    h = screen_th
    new_h = screen_th(x,y)
    if CLIMBABLE_MOVE > (new_h-h) and DROPABLE_MOVE < (new_h-h)
      return true
    else
      return false
    end
  end
end

#==============================================================================
# ? Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ? Start
#--------------------------------------------------------------------------
  alias ge_iso_evnt_start start
  def start
    if !$game_map.iso?
      ge_iso_evnt_start
      return
    end
    h = screen_th($game_player.x, $game_player.y)
    ev_h = screen_th
   
    if @list.size > 1 and (ev_h - h).abs <= 1
      @starting = true
    end
  end
end

#==============================================================================
# ? Game_Character - Jump Update
#==============================================================================
class Game_Character
  #-------------------------------------------------------------------------- 
  # * Initialize Objects
  #--------------------------------------------------------------------------
  alias gc_isopix_init initialize
  def initialize
    gc_isopix_init
    @end_press = true
    @move_set = 0
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias gc_isopix_upd update
  def update
    @move_set = 0  #Counter so that update move is not run more than once
    gc_isopix_upd
  end
 
  #--------------------------------------------------------------------------
  # * Update While Jumping
  #--------------------------------------------------------------------------
  alias gc_isopix_upd_jmp update_jump
  def update_jump
    if self.is_a?(Game_Player)
      @end_press = true if !Input.press?(Input::Z)
      if MOVE_WHILE_JUMP
        update_move
      end
      if Input.press?(Input::Z) and !@end_press and @jump_peak != 8
        @jump_peak += 1
        @jump_count += 2
      end
    end
    gc_isopix_upd_jmp
  end
  #--------------------------------------------------------------------------
  # * Update Move - This prevents update_move from being run more than once
  #    during any update cycle.
  #--------------------------------------------------------------------------
  alias gc_isopix_upd_move update_move
  def update_move
    if @move_set == 0
      @move_set += 1
      gc_isopix_upd_move
    end
  end
  #--------------------------------------------------------------------------
  # * IsoJump
  #--------------------------------------------------------------------------
  def iso_jump
    @end_press = false
    @jump_peak = 1
    @jump_count = @jump_peak * 2
    @stop_count = 0
  end
  #--------------------------------------------------------------------------
  # * Passable? - Jump Update
  #--------------------------------------------------------------------------
  def passable?(x, y)
    if $game_map.iso? == 0
      return gc_iso_passable?(x, y)
    end
    x = $game_map.round_x(x)                        # Horizontal loop adj.
    y = $game_map.round_y(y)                        # Vertical loop adj.
    return false unless $game_map.valid?(x, y)      # Outside map?
    return true if @through or debug_through?       # Through ON?
    return false unless map_passable?(x, y)         # Map Impassable?
    return false if collide_with_characters?(x, y)  # Collide with character?
   
    h = screen_th
    new_h = screen_th(x,y)
    if (CLIMBABLE_MOVE+((@jump_count/2)/2)) >= (new_h-h) and DROPABLE_MOVE <= (new_h-h)
      return true
    else
      return false
    end
  end
end
#==============================================================================
# Game_Player - Jump Update
#==============================================================================
class Game_Player < Game_Character
  alias gmpl_isopix_update update
  def update
    gmpl_isopix_update
    if $scene.is_a?(Scene_Map) and !$game_message.visible and $game_temp.next_scene == nil
      if ISO_ENABLE_JUMP and !jumping? and Input.trigger?(Input::Z)
        iso_jump
        return
      end
    end
  end
end


4-Way-Pixelmovement (Optional)
=begin

#==============================================================================
#  4 DIRECTIONAL PIXEL MOVEMENT - Player only!
#==============================================================================

#==============================================================================
# ? Game_Player
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # ? Initialize
  #--------------------------------------------------------------------------
  alias gc_pix_init initialize
  def initialize
    gc_pix_init
    @x = 0.0
    @y = 0.0
    @real_x = 0.0
    @real_y = 0.0
    @inc_steps = 0
  end
  #--------------------------------------------------------------------------
  # * Increase Steps
  #--------------------------------------------------------------------------
  alias gc_pix_inc_stps increase_steps
  def increase_steps
    if @inc_steps >= 4
      gc_pix_inc_stps
      @inc_steps = 0
    else
      @inc_steps += 1
    end
  end
  #--------------------------------------------------------------------------
  # * Move Down
  #     turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def move_down(turn_ok = true)
    if passable?(@x.to_i, @y.to_i+1)                  # Passable
      turn_down
      @y += 1.0/4
      if $game_map.loop_vertical?
        @y += $game_map.height
        @y %= $game_map.height
      end
      @real_y = (@y-1.0/4)*256
      increase_steps
      @move_failed = false
    else                                    # Impassable
      if @y < @y.to_i+1-(1.0/4) #if there is still area to move but next square is impassable
        turn_down
        @y += 1.0#/8
        if $game_map.loop_vertical?
          @y += $game_map.height
          @y %= $game_map.height
        end
        @real_y = (@y-1.0/4)*256
        increase_steps
        @move_failed = false
        return
      end
      turn_down if turn_ok
      check_event_trigger_touch(@x.to_i, @y.to_i+1)   # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Move Left
  #     turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def move_left(turn_ok = true)
    if passable?(@x.to_i-1, @y.to_i)                  # Passable
      turn_left
      @x -= 1.0/4
      if $game_map.loop_horizontal?
        @y += $game_map.width
        @y %= $game_map.width
      end
      @real_x = (@x+1.0/4)*256
      increase_steps
      @move_failed = false
    else                                    # Impassable
      if @x.to_i < @x #if there is still area to move but next square is impassable
        turn_left
        @x -= 1.0/4
        if $game_map.loop_horizontal?
          @y += $game_map.width
          @y %= $game_map.width
        end
        @real_x = (@x+1.0/4)*256
        increase_steps
        @move_failed = false
        return
      end
      turn_left if turn_ok
      check_event_trigger_touch(@x.to_i-1, @y.to_i)   # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Move Right
  #     turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def move_right(turn_ok = true)
    if passable?(@x.to_i+1, @y.to_i)                  # Passable
      turn_right
      @x += 1.0/4
      if $game_map.loop_horizontal?
        @y += $game_map.width
        @y %= $game_map.width
      end
      @real_x = (@x-1.0/4).to_f*256
      increase_steps
      @move_failed = false
    else                                    # Impassable
      if @x < @x.to_i+1-(1.0/4) #if there is still area to move but next square is impassable
        turn_right
        @x += 1.0/4
        if $game_map.loop_horizontal?
          @y += $game_map.width
          @y %= $game_map.width
        end
        @real_x = (@x-1.0/4).to_f*256
        increase_steps
        @move_failed = false
        return
      end
     
      turn_right if turn_ok
      check_event_trigger_touch(@x.to_i+1, @y.to_i)   # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Move up
  #     turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def move_up(turn_ok = true)
    if passable?(@x.to_i, @y.to_i-1)                  # Passable
      turn_up
      @y -= 1.0/4
      if $game_map.loop_vertical?
        @y += $game_map.height
        @y %= $game_map.height
      end
      @real_y = (@y+1.0/4)*256
      increase_steps
      @move_failed = false
    else                                    # Impassable
      if @y.to_i < @y #if there is still area to move but next square is impassable
        turn_up
        @y -= 1.0/4
        if $game_map.loop_vertical?
          @y += $game_map.height
          @y %= $game_map.height
        end
        @real_y = (@y+1.0/4)*256
        increase_steps
        @move_failed = false
        return
      end
      turn_up if turn_ok
      check_event_trigger_touch(@x.to_i, @y.to_i-1)   # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if Same Position Event is Triggered
  #     triggers : Trigger array
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers)
    return false if $game_map.interpreter.running?
    result = false
    for event in $game_map.events_xy(@x.to_i, @y.to_i)
      if triggers.include?(event.trigger) and event.priority_type != 1
        event.start
        result = true if event.starting
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Determine if Front Event is Triggered
  #     triggers : Trigger array
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    return false if $game_map.interpreter.running?
    result = false
    front_x = $game_map.x_with_direction(@x.to_i, @direction)
    front_y = $game_map.y_with_direction(@y.to_i, @direction)
    for event in $game_map.events_xy(front_x, front_y)
      if triggers.include?(event.trigger) and event.priority_type == 1
        event.start
        result = true
      end
    end
    if result == false and $game_map.counter?(front_x, front_y)
      front_x = $game_map.x_with_direction(front_x, @direction)
      front_y = $game_map.y_with_direction(front_y, @direction)
      for event in $game_map.events_xy(front_x, front_y)
        if triggers.include?(event.trigger) and event.priority_type == 1
          event.start
          result = true
        end
      end
    end
    return result
  end
end
=end
Titel: Re: Maps in einer 30 Grad Drehung?
Beitrag von: Juggernaut am April 29, 2010, 22:04:05
hey wollt mal das pixel movement script ausprobieren... suche schon ne ewigkeit nach einem...
Muss aber leider sagen dass deins hier gebuggt is... wennu von oben annen event gehst wirste drunter "geportet" :( schade eigentlich
SimplePortal 2.3.3 © 2008-2010, SimplePortal