扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 102|回复: 0

[转载发布] VA如何通过地图的备注来启动插件脚本?

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    3 天前
  • 签到天数: 160 天

    连续签到: 1 天

    [LV.7]常住居民III

    2470

    主题

    511

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    13560
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    16569

    灌水之王

    发表于 昨天 15:29 | 显示全部楼层 |阅读模式
    如题:RPG maker VA怎么修改插件的代码,在地图设置里的备注写上一些开启代码,插件就会在这个地图里运行,在备注空白的其他地图里,插件就不会该地图里运行。
    RUBY 代码
    1. module CXJ
    2.   module FREE_MOVEMENT
    3.     ENABLE_DIAGONAL = true    # Enables diagonal movement.
    4.     DEFAULT_COLLISION = [8, 12, 16, 20]
    5.     DEFAULT_INTERACTION = {
    6.     2 => [4, 0, 24, 24],
    7.     4 => [16, 10, 24, 24],
    8.     6 => [-8, 10, 24, 24],
    9.     8 => [4, 20, 24, 24],
    10.     }
    11.     BOAT_COLLISION      = [4, 4, 24, 24]
    12.     AIRSHIP_COLLISION   = [4, 8, 24, 24]
    13.     PIXELS_PER_STEP = 4
    14.     FOLLOWERS_DISTANCE = 16
    15.     FOLLOWERS_DISTANCE_MARGIN = 4
    16.     JUMP_SPEED = 0.5
    17.   end
    18. end
    19. #==============================================================================
    20. # ** Game_Map
    21. #------------------------------------------------------------------------------
    22. #  This class handles maps. It includes scrolling and passage determination
    23. # functions. The instance of this class is referenced by $game_map.
    24. #==============================================================================
    25. class Game_Map
    26.   #--------------------------------------------------------------------------
    27.   # * New: Determine Valid Coordinates
    28.   #--------------------------------------------------------------------------
    29.   def valid_rect?(x, y, rect)
    30.     x2 = x + (rect.x / 32.0)
    31.     y2 = y + (rect.y / 32.0)
    32.     x3 = x2 + (rect.width / 32.0)
    33.     y3 = y2 + (rect.height / 32.0)
    34.     round_x(x2) >= 0 && round_x(x3) < width && round_y(y2) >= 0 && round_y(y3) < height
    35.   end
    36.   #--------------------------------------------------------------------------
    37.   # * Override: Check Passage
    38.   #     bit:  Inhibit passage check bit
    39.   #--------------------------------------------------------------------------
    40.   def check_passage(x, y, bit)
    41.     x = round_x(x)
    42.     y = round_y(y)
    43.     all_tiles(x, y).eachdo |tile_id|
    44.       flag = tileset.flags[tile_id]
    45.       nextif flag & 0x10 != 0            # [☆]: No effect on passage
    46.       returntrue  if flag & bit == 0     # [○] : Passable
    47.       returnfalseif flag & bit == bit   # [×] : Impassable
    48.     end
    49.     returnfalse                          # Impassable
    50.   end
    51.   #--------------------------------------------------------------------------
    52.   # * New: Determine Passability of Normal Character
    53.   #     d:  direction (2,4,6,8)
    54.   #    Determines whether the tile at the specified coordinates is passable
    55.   #    in the specified direction.
    56.   #--------------------------------------------------------------------------
    57.   def passable_rect?(x, y, d, rect)
    58.     x2 = x + (rect.x / 32.0)
    59.     y2 = y + (rect.y / 32.0)
    60.     x3 = x2 + (rect.width / 32.0)
    61.     y3 = y2 + (rect.height / 32.0)
    62.     returnfalseunless check_passage(x2, y2, (1  2 && d < 8
    63.       end
    64.     end
    65.     @stop_count = 0
    66.   end
    67.   #--------------------------------------------------------------------------
    68.   # * Override: Move Straight
    69.   #     d:        Direction (2,4,6,8)
    70.   #     turn_ok : Allows change of direction on the spot
    71.   #
    72.   # Polls the movement instead of processing them immediately.
    73.   #--------------------------------------------------------------------------
    74.   def move_straight(d, turn_ok = true)
    75.     pixelstep = CXJ::FREE_MOVEMENT::PIXELS_PER_STEP / 32.0
    76.     @move_poll+= [[d, turn_ok]] * (distance_per_frame / pixelstep).ceil
    77.   end
    78.   #--------------------------------------------------------------------------
    79.   # * Override: Move Diagonally
    80.   #     horz:  Horizontal (4 or 6)
    81.   #     vert:  Vertical (2 or 8)
    82.   #
    83.   # Polls the movement instead of processing them immediately.
    84.   #--------------------------------------------------------------------------
    85.   def move_diagonal(horz, vert)
    86.     pixelstep = CXJ::FREE_MOVEMENT::PIXELS_PER_STEP / 32.0
    87.     @move_poll+= [[vert + (horz > 5 ? 1 : -1), true]] * (distance_per_frame / pixelstep).ceil
    88.   end
    89.   #--------------------------------------------------------------------------
    90.   # * New: Determine Coordinate Match
    91.   #--------------------------------------------------------------------------
    92.   def pos_rect?(x, y, rect)
    93.     main_left = @x + collision_rect.x / 32.0
    94.     main_top = @y + collision_rect.y / 32.0
    95.     main_right = main_left + collision_rect.width / 32.0
    96.     main_bottom = main_top + collision_rect.height / 32.0
    97.     other_left = x + rect.x / 32.0
    98.     other_top = y + rect.y / 32.0
    99.     other_right = other_left + rect.width / 32.0
    100.     other_bottom = other_top + rect.height / 32.0
    101.     coltest = true
    102.     coltest = falseif main_right < other_left
    103.     coltest = falseif main_left > other_right
    104.     coltest = falseif main_bottom < other_top
    105.     coltest = falseif main_top > other_bottom
    106.     if coltest == false && ($game_map.loop_horizontal? || $game_map.loop_vertical?) && x  0 ? 4 : 6, true]]
    107.       @move_poll+= [[sy > 0 ? 8 : 2, true]]if !@move_succeed && sy != 0
    108.     elsif sy != 0
    109.       @move_poll+= [[sy > 0 ? 8 : 2, true]]
    110.       @move_poll+= [[sx > 0 ? 4 : 6, true]]if !@move_succeed && sx != 0
    111.     end
    112.   end
    113.   #--------------------------------------------------------------------------
    114.   # * Move Away from Character
    115.   #--------------------------------------------------------------------------
    116.   def move_away_from_character(character)
    117.     sx = distance_x_from(character.x)
    118.     sy = distance_y_from(character.y)
    119.     if sx.abs > sy.abs
    120.       move_straight(sx > 0 ? 6 : 4)
    121.       move_straight(sy > 0 ? 2 : 8)if !@move_succeed && sy != 0
    122.     elsif sy != 0
    123.       move_straight(sy > 0 ? 2 : 8)
    124.       move_straight(sx > 0 ? 6 : 4)if !@move_succeed && sx != 0
    125.     end
    126.   end
    127.   #--------------------------------------------------------------------------
    128.   # * Override: Jump
    129.   #     x_plus : x-coordinate plus value
    130.   #     y_plus : y-coordinate plus value
    131.   #--------------------------------------------------------------------------
    132.   def jump(x_plus, y_plus)
    133.     if x_plus.abs > y_plus.abs
    134.       set_direction(x_plus < 0 ? 4 : 6)if x_plus != 0
    135.     else
    136.       set_direction(y_plus < 0 ? 8 : 2)if y_plus != 0
    137.     end
    138.     distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
    139.     pollcount = distance * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil
    140.     @move_poll+= [[(x_plus < 0 ? -1 : x_plus > 0 ? 1 : 0) + (y_plus < 0 ? 8 : y_plus > 0 ? 2 : 5), false]] * pollcount
    141.     @jump_peak = 10 + distance - @move_speed
    142.     @jump_count = @jump_peak / CXJ::FREE_MOVEMENT::JUMP_SPEED * 2
    143.     @stop_count = 0
    144.     straighten
    145.   end
    146. end
    147. #==============================================================================
    148. # ** Game_Player
    149. #------------------------------------------------------------------------------
    150. #  This class handles the player. It includes event starting determinants and
    151. # map scrolling functions. The instance of this class is referenced by
    152. # $game_player.
    153. #==============================================================================
    154. class Game_Player < Game_Character
    155.   #--------------------------------------------------------------------------
    156.   # * Object Initialization
    157.   #--------------------------------------------------------------------------
    158.   alias game_player_initialize_cxj_fm initialize
    159.   def initialize
    160.     @last_poll = []
    161.     game_player_initialize_cxj_fm
    162.     @custom_collision = []
    163.     @interaction = CXJ::FREE_MOVEMENT::DEFAULT_INTERACTION
    164.     if@note =~ //i
    165.       @custom_collision = Rect.new($1, $2, $3 - 1, $4)
    166.     end
    167.     if@note =~ //i && $1 > 0 && $1 < 10 && $1 % 2 == 0
    168.       @interaction[$1] = [$2, $3, $4, $5]
    169.     end
    170.   end
    171.   #--------------------------------------------------------------------------
    172.   # * New: Movement Interpreting
    173.   #     Interprets the polled movement.
    174.   #--------------------------------------------------------------------------
    175.   def interpret_move(step_left = distance_per_frame)
    176.     current_move = super(step_left)
    177.     @last_poll.push(current_move)if !current_move.nil?
    178.   end
    179.   #--------------------------------------------------------------------------
    180.   # * New: Collision Rectangle
    181.   #     Gets the collision rectangle.
    182.   #--------------------------------------------------------------------------
    183.   def collision_rect
    184.     return@custom_collisionif@custom_collision.size > 0
    185.     returnsuper
    186.   end
    187.   #--------------------------------------------------------------------------
    188.   # * New: Interaction Rectangle
    189.   #     Gets the interaction rectangle.
    190.   #--------------------------------------------------------------------------
    191.   def interaction_rect
    192.     collision = @interaction[@direction]
    193.     return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)
    194.   end
    195.   #--------------------------------------------------------------------------
    196.   # * Override: Processing of Movement via Input from Directional Buttons
    197.   #
    198.   # Added diagonal movement.
    199.   #--------------------------------------------------------------------------
    200.   def move_by_input
    201.     returnif !movable? || $game_map.interpreter.running?
    202.     ifCXJ::FREE_MOVEMENT::ENABLE_DIAGONAL && Input.dir8 > 0 && Input.dir8 % 2 != 0
    203.       d = Input.dir8
    204.       horz = (d == 1 || d == 7 ? 4 : 6)
    205.       vert = (d == 1 || d == 3 ? 2 : 8)
    206.       move_diagonal(horz, vert)
    207.     elsif Input.dir4 > 0
    208.       move_straight(Input.dir4)
    209.     end
    210.   end
    211.   #--------------------------------------------------------------------------
    212.   # * Detect Collision (Including Followers)
    213.   #--------------------------------------------------------------------------
    214.   def collide_rect?(x, y, rect)
    215.     !@through && (pos_rect?(x, y, rect) || followers.collide_rect?(x, y, rect))
    216.   end
    217.   #--------------------------------------------------------------------------
    218.   # * Trigger Map Event
    219.   #     triggers : Trigger array
    220.   #     normal   : Is priority set to [Same as Characters] ?
    221.   #--------------------------------------------------------------------------
    222.   def start_map_event(x, y, triggers, normal, rect = collision_rect)
    223.     returnif$game_map.interpreter.running?
    224.     $game_map.events_xy_rect(x, y, rect).eachdo |event|
    225.       if event.trigger_in?(triggers) && event.normal_priority? == normal
    226.         event.start
    227.       end
    228.     end
    229.   end
    230.   #--------------------------------------------------------------------------
    231.   # * Determine if Front Event is Triggered
    232.   #--------------------------------------------------------------------------
    233.   def check_event_trigger_there(triggers)
    234.     x2 = $game_map.round_x_with_direction(@x, @direction)
    235.     y2 = $game_map.round_y_with_direction(@y, @direction)
    236.     start_map_event(x2, y2, triggers, true, interaction_rect)
    237.     returnif$game_map.any_event_starting?
    238.     returnunless$game_map.counter?(x2, y2)
    239.     x3 = $game_map.round_x_with_direction(x2, @direction)
    240.     y3 = $game_map.round_y_with_direction(y2, @direction)
    241.     start_map_event(x3, y3, triggers, true, interaction_rect)
    242.   end
    243.   #--------------------------------------------------------------------------
    244.   # * Board Vehicle
    245.   #    Assumes that the player is not currently in a vehicle.
    246.   #--------------------------------------------------------------------------
    247.   def get_on_vehicle
    248.     front_x = $game_map.round_x_with_direction(@x, @direction)
    249.     front_y = $game_map.round_y_with_direction(@y, @direction)
    250.     @vehicle_type = :boat    if$game_map.boat.pos_rect?(front_x, front_y, interaction_rect)
    251.     @vehicle_type = :ship    if$game_map.ship.pos_rect?(front_x, front_y, interaction_rect)
    252.     @vehicle_type = :airshipif$game_map.airship.pos_rect?(@x, @y, collision_rect)
    253.     if vehicle
    254.       @vehicle_getting_on = true
    255.       horz = (@x > vehicle.x ? -1 : @x < vehicle.x ? 1 : 0)
    256.       vert = (@y > vehicle.y ? -3 : @y < vehicle.y ? 3 : 0)
    257.       d = 5 + horz - vert
    258.       set_direction(d)
    259.       @x = vehicle.x
    260.       @y = vehicle.y
    261.       @followers.gather
    262.     end
    263.     @vehicle_getting_on
    264.   end
    265.   #--------------------------------------------------------------------------
    266.   # * Get Off Vehicle
    267.   #    Assumes that the player is currently riding in a vehicle.
    268.   #--------------------------------------------------------------------------
    269.   def get_off_vehicle
    270.     if vehicle.land_ok?(@x, @y, @direction)
    271.       set_direction(2)if in_airship?
    272.       @followers.synchronize(@x, @y, @direction)
    273.       vehicle.get_off
    274.       unless in_airship?
    275.         @x = $game_map.round_x_with_direction(@x, @direction)
    276.         @y = $game_map.round_y_with_direction(@y, @direction)
    277.         @transparent = false
    278.       end
    279.       @vehicle_getting_off = true
    280.       @move_speed = 4
    281.       @through = false
    282.       make_encounter_count
    283.       @followers.gather
    284.     end
    285.     @vehicle_getting_off
    286.   end
    287.   #--------------------------------------------------------------------------
    288.   # * Determine if Map is Passable
    289.   #     d:  Direction (2,4,6,8)
    290.   #--------------------------------------------------------------------------
    291.   def map_passable_rect?(x, y, d, rect)
    292.     case@vehicle_type
    293.     when:boat
    294.       $game_map.boat_passable_rect?(x, y, vehicle.collision_rect)
    295.     when:ship
    296.       $game_map.ship_passable_rect?(x, y, vehicle.collision_rect)
    297.     when:airship
    298.       true
    299.     else
    300.       super
    301.     end
    302.   end
    303.   #--------------------------------------------------------------------------
    304.   # * Override: Move Diagonally
    305.   #--------------------------------------------------------------------------
    306.   def move_diagonal(horz, vert)
    307.     @followers.moveif diagonal_passable?(@x, @y, horz, vert) || passable?(@x, @y, horz + 5) || passable?(@x, @y, 5 - vert * 3)
    308.     super
    309.   end
    310.   #--------------------------------------------------------------------------
    311.   # * Alias: Create Encounter Count
    312.   #--------------------------------------------------------------------------
    313.   alias game_player_make_encounter_count_cxj_fm make_encounter_count
    314.   def make_encounter_count
    315.     game_player_make_encounter_count_cxj_fm
    316.     @encounter_count*= (32 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP) + (32 / 2 < CXJ::FREE_MOVEMENT::PIXELS_PER_STEP ? 1 : 0)
    317.   end
    318.   #--------------------------------------------------------------------------
    319.   # * Detect Collision with Vehicle
    320.   #--------------------------------------------------------------------------
    321.   def collide_with_vehicles?(x, y)
    322.     (@vehicle_type != :boat && $game_map.boat.pos_rect_nt?(x, y, collision_rect)) || (@vehicle_type != :ship && $game_map.ship.pos_rect_nt?(x, y, collision_rect))
    323.   end
    324.   #--------------------------------------------------------------------------
    325.   # * Processing When Not Moving
    326.   #     last_moving : Was it moving previously?
    327.   #--------------------------------------------------------------------------
    328.   alias game_player_update_nonmoving_cxj_fm update_nonmoving
    329.   def update_nonmoving(last_moving)
    330.     game_player_update_nonmoving_cxj_fm(last_moving)
    331.     update_encounter if !last_moving && !@last_poll.empty?
    332.     @last_poll.clear
    333.   end
    334. end
    335. #==============================================================================
    336. # ** Game_Followers
    337. #------------------------------------------------------------------------------
    338. #  This is a wrapper for a follower array. This class is used internally for
    339. # the Game_Player class.
    340. #==============================================================================
    341. class Game_Followers
    342.   #--------------------------------------------------------------------------
    343.   # * Detect Collision
    344.   #--------------------------------------------------------------------------
    345.   def collide_rect?(x, y, rect)
    346.     visible_folloers.any? {|follower| follower.pos_rect?(x, y, rect)}
    347.   end
    348.   #--------------------------------------------------------------------------
    349.   # * Movement
    350.   #--------------------------------------------------------------------------
    351.   def move
    352.     reverse_each {|follower| follower.boardif gathering?; follower.chase_preceding_character}
    353.   end
    354. end
    355. #==============================================================================
    356. # ** Game_Vehicle
    357. #------------------------------------------------------------------------------
    358. #  This class handles vehicles. It's used within the Game_Map class. If there
    359. # are no vehicles on the current map, the coordinates are set to (-1,-1).
    360. #==============================================================================
    361. class Game_Vehicle < Game_Character
    362.   #--------------------------------------------------------------------------
    363.   # * New: Collision Rectangle
    364.   #     Gets the collision rectangle.
    365.   #--------------------------------------------------------------------------
    366.   def collision_rect
    367.     collision = CXJ::FREE_MOVEMENT::DEFAULT_COLLISION
    368.     case@type
    369.     when:boat
    370.       collision = CXJ::FREE_MOVEMENT::BOAT_COLLISION
    371.     when:airship
    372.       collision = CXJ::FREE_MOVEMENT::AIRSHIP_COLLISION
    373.     end
    374.     return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)
    375.   end
    376.   #--------------------------------------------------------------------------
    377.   # * Determine if Docking/Landing Is Possible
    378.   #     d:  Direction (2,4,6,8)
    379.   #--------------------------------------------------------------------------
    380.   def land_ok?(x, y, d)
    381.     if@type == :airship
    382.       returnfalseunless$game_map.airship_land_ok_rect?(x, y, collision_rect)
    383.       returnfalseunless$game_map.events_xy_rect(x, y, collision_rect).empty?
    384.     else
    385.       x2 = $game_map.round_x_with_direction(x, d)
    386.       y2 = $game_map.round_y_with_direction(y, d)
    387.       returnfalseunless$game_map.valid_rect?(x2, y2, collision_rect)
    388.       returnfalseunless$game_map.passable_rect?(x2, y2, reverse_dir(d), collision_rect)
    389.       returnfalseif collide_with_characters?(x2, y2)
    390.     end
    391.     returntrue
    392.   end
    393. end
    394. #==============================================================================
    395. # ** Game_Event
    396. #------------------------------------------------------------------------------
    397. #  This class handles events. Functions include event page switching via
    398. # condition determinants and running parallel process events. Used within the
    399. # Game_Map class.
    400. #==============================================================================
    401. class Game_Event < Game_Character
    402.   #--------------------------------------------------------------------------
    403.   # * Initialize Public Member Variables
    404.   #--------------------------------------------------------------------------
    405.   alias game_event_init_public_members_cxj_fm init_public_members
    406.   def init_public_members
    407.     game_event_init_public_members_cxj_fm
    408.     @collisionbox = Rect.new(0, 0, 31, 31)
    409.   end
    410.   #--------------------------------------------------------------------------
    411.   # * Initialize Public Member Variables
    412.   #--------------------------------------------------------------------------
    413.   def set_collision_rect(x, y, width, height)
    414.     @collisionbox = Rect.new(x, y, width - 1, height - 1)
    415.   end
    416.   #--------------------------------------------------------------------------
    417.   # * New: Collision Rectangle
    418.   #     Gets the collision rectangle.
    419.   #--------------------------------------------------------------------------
    420.   def collision_rect
    421.     return@collisionbox
    422.   end
    423.   #--------------------------------------------------------------------------
    424.   # * Override: Move Straight
    425.   #     d:        Direction (2,4,6,8)
    426.   #     turn_ok : Allows change of direction on the spot
    427.   #
    428.   # Polls the movement instead of processing them immediately.
    429.   #--------------------------------------------------------------------------
    430.   def move_straight(d, turn_ok = true)
    431.     @move_poll+= [[d, turn_ok]] * (rand(32 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP))
    432.   end
    433.   #--------------------------------------------------------------------------
    434.   # * Detect Collision with Player (Including Followers)
    435.   #--------------------------------------------------------------------------
    436.   def collide_with_player_characters?(x, y)
    437.     normal_priority? && $game_player.collide_rect?(x, y, collision_rect)
    438.   end
    439. end
    440. #==============================================================================
    441. # ** Game_Follower
    442. #------------------------------------------------------------------------------
    443. #  This class handles followers. A follower is an allied character, other than
    444. # the front character, displayed in the party. It is referenced within the
    445. # Game_Followers class.
    446. #==============================================================================
    447. class Game_Follower < Game_Character
    448.   #--------------------------------------------------------------------------
    449.   # * Alias: Object Initialization
    450.   #--------------------------------------------------------------------------
    451.   alias game_follower_initialize_cxj_fm initialize
    452.   def initialize(member_index, preceding_character)
    453.     game_follower_initialize_cxj_fm(member_index, preceding_character)
    454.     @force_chase = false
    455.     @board = false
    456.   end
    457.   #--------------------------------------------------------------------------
    458.   # * Pursue Preceding Character
    459.   #--------------------------------------------------------------------------
    460.   def chase_preceding_character
    461.     unless moving? && !@force_chase
    462.       dist = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE / 32.0
    463.       mrgn = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE_MARGIN / 32.0
    464.       sx = distance_x_from(@preceding_character.x)
    465.       sy = distance_y_from(@preceding_character.y)
    466.       sd = Math.hypot(sx, sy)
    467.       if@board
    468.         @x = @preceding_character.x
    469.         @y = @preceding_character.y
    470.         @board = false
    471.       elsif(sd > dist && sx.abs > mrgn && sy.abs > mrgn)
    472.         @move_poll+=[[(sx > 0 ? -1 : 1) + (sy > 0 ? 8 : 2), true]]
    473.       elsif sx.abs > dist && sx.abs > sy.abs
    474.         @move_poll+=[[sx > 0 ? 4 : 6, true]]
    475.       elsif sy.abs > dist && sx.abs < sy.abs
    476.         @move_poll+=[[sy > 0 ? 8 : 2, true]]
    477.       end
    478.     end
    479.   end
    480.   def distance_preceding_character
    481.     sx = distance_x_from(@preceding_character.x)
    482.     sy = distance_y_from(@preceding_character.y)
    483.     returnMath.hypot(sx, sy)
    484.   end
    485.   def process_move(horz, vert)
    486.     super(horz, vert)
    487.     dist = CXJ::FREE_MOVEMENT::FOLLOWERS_DISTANCE / 32.0
    488.     if distance_preceding_character > dist && @move_poll.size == 0
    489.       @force_chase = true
    490.       chase_preceding_character
    491.       @force_chase = false
    492.     end
    493.   end
    494.   def board
    495.     @board = true
    496.   end
    497. end
    498. #==============================================================================
    499. # ** Game_Interpreter
    500. #------------------------------------------------------------------------------
    501. #  An interpreter for executing event commands. This class is used within the
    502. # Game_Map, Game_Troop, and Game_Event classes.
    503. #==============================================================================
    504. class Game_Interpreter
    505.   #--------------------------------------------------------------------------
    506.   # * Initialize Public Member Variables
    507.   #--------------------------------------------------------------------------
    508.   def set_collision_rect(x, y, width, height)
    509.     $game_map.events[@event_id].set_collision_rect(x, y, width, height)
    510.   end
    511. end
    512. =begin
    513. class Spriteset_Map
    514.   #--------------------------------------------------------------------------
    515.   # * Object Initialization
    516.   #--------------------------------------------------------------------------
    517.   def initialize
    518.     create_viewports
    519.     create_tilemap
    520.     create_parallax
    521.     create_characters
    522.     create_shadow
    523.     create_weather
    524.     create_pictures
    525.     create_timer
    526.     @colbox = Sprite.new
    527.     @colbox.bitmap = Bitmap.new(96, 96)
    528.     update
    529.   end
    530.   #--------------------------------------------------------------------------
    531.   # * Frame Update
    532.   #--------------------------------------------------------------------------
    533.   def update
    534.     update_tileset
    535.     update_tilemap
    536.     update_parallax
    537.     update_characters
    538.     update_shadow
    539.     update_weather
    540.     update_pictures
    541.     update_timer
    542.     update_viewports
    543.     @colbox.x = $game_player.screen_x - 48
    544.     @colbox.y = $game_player.screen_y - 64
    545.     @colbox.bitmap.clear
    546.     @colbox.bitmap.fill_rect(0, 0, 96, 96, Color.new(0, 0, 0, 64))
    547.     cRec = $game_player.collision_rect.dup
    548.     iRec = $game_player.interaction_rect.dup
    549.     d = $game_player.direction
    550.     cRec.set(cRec.x + 32, cRec.y + 32, cRec.width, cRec.height)
    551.     @colbox.bitmap.fill_rect(cRec, Color.new(0, 255, 0, 128))
    552.     #iRec.set(iRec.x + 32, iRec.y + 32, iRec.width, iRec.height)
    553.     iRec.set(iRec.x + 32 + 32 * (d == 4 ? -1 : d == 6 ? 1 : 0), iRec.y + 32 + 32 * (d == 8 ? -1 : d == 2 ? 1 : 0), iRec.width, iRec.height)
    554.     #iRec.set(iRec.x + 48 + 32 * (d == 4 ? -1 : d == 6 ? 1 : 0), iRec.y + 64 + 32 * (d == 8 ? -1 : d == 2 ? 1 : 0), iRec.width, iRec.height)
    555.     @colbox.bitmap.fill_rect(iRec, Color.new(255, 0, 0, 128))
    556.   end
    557. end
    558. =end
    复制代码


                本帖来自P1论坛作者lifrtam,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=497866  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-8-8 13:16 , Processed in 0.116599 second(s), 58 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表