赞 | 4 |
VIP | 0 |
好人卡 | 0 |
积分 | 6 |
经验 | 0 |
最后登录 | 2019-11-27 |
在线时间 | 53 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 586
- 在线时间
- 53 小时
- 注册时间
- 2018-1-5
- 帖子
- 20
|
- ALLMAP = 224 #记录已开启地图的变量的ID。
- OPENMAP = 225 #记录已开启地图的变量的ID。
- FR = 20 #聚焦半径,当交叉点的坐标离地图目标距离在20个像素以内时,会自动移动靠近。
- module SATEMAP
- #定义目标地图,举例:
- #TAGMAP[1] = [400,139,14,4,8]
- #1表示地图ID,400和139表示点在大地图上的坐标,14和4表示场所移动后的坐标。8是朝向。
- #也就是说,当横轴与纵轴的交叉点坐标为400,139时,玩家按下确定键,角色就会面朝上移动到
- #1号地图坐标为14,4的地点。
- TAGMAP = []
- TAGMAP[11] = [298,23,6,6,2]#森林,面朝右
- TAGMAP[14] = [393,160,13,11,2]#山村,面朝右
- TAGMAP[17] = [318,248,21,5,2]#沉默,面朝上
- TAGMAP[20] = [318,195,54,15,4]#沉默,面朝上
- TAGMAP[24] = [521,463,28,24,4]
- TAGMAP[26] = [466,385,10,58,8]
- TAGMAP[27] = [523,225,1,36,6]
- TAGMAP[30] = [589,347,22,30,6]
- TAGMAP[32] = [541,351,12,24,8]
- TAGMAP[36] = [184,196,28,33,8]
- TAGMAP[33] = [12,334,4,17,8]
- TAGMAP[37] = [216,323,45,9,8]
- TAGMAP[44] = [242,349,5,8,2]
- TAGMAP[39] = [352,322,6,9,8]
- PLACEMAP=[]
- PLACEMAP[11] = [298,23]#森林,面朝右
- PLACEMAP[12] = [219,67]#森林,面朝右
- PLACEMAP[13] = [440,55]#森林,面朝右
- PLACEMAP[14] = [393,160]#山村,面朝右
- PLACEMAP[15] = [497,174]#森林,面朝右
- PLACEMAP[16] = [316,186]#森林,面朝右
- PLACEMAP[17] = [318,248]#沉默,面朝上
- PLACEMAP[18] = [287,363]#沉默,面朝上
- PLACEMAP[19] = [237,451]#沉默,面朝上
- PLACEMAP[20] = [318,195]#沉默,面朝上
- PLACEMAP[24] = [521,463]
- PLACEMAP[25] = [393,428]
- PLACEMAP[26] = [466,385]
- PLACEMAP[27] = [523,225]
- PLACEMAP[28] = [484,138]
- PLACEMAP[29] = [593,45]
- PLACEMAP[30] = [589,347]
- PLACEMAP[32] = [541,351]
- PLACEMAP[33] = [12,334]
- PLACEMAP[34] = [39,385]
- PLACEMAP[36] = [184,196]
- PLACEMAP[37] = [216,323]
- PLACEMAP[44] = [242,349]
- PLACEMAP[39] = [352,322]
- PLACEMAP[41] = [173,316]
- PLACEMAP[38] = [284,322]
- PLACEMAP[42] = [394,316]
- PLACEMAP[40] = [484,324]
- PLACEMAP[43] = [484,316]
- end
- #==============================================================================
- # ■ Scene_Satellite
- #------------------------------------------------------------------------------
- # 处理卫星地图画面
- #==============================================================================
- class Scene_Satellite
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @tagmap=SATEMAP::TAGMAP
- @placemap=SATEMAP::PLACEMAP
- case $game_variables[451]
- when -1
- @tagmap[11] = [365,306,6,6,2]
- @tagmap[24] = [478,121,28,24,4]
- @tagmap[36] = [184,196,28,33,8]
- @placemap[11] = [365,306]
- @placemap[24] = [478,121]
- @placemap[36] = [184,196]
- when 0
- @tagmap[11] = [298,23,6,6,2]
- @placemap[11] = [298,23]
- when 1
- @tagmap[24] = [521,463,28,24,4]
- @placemap[24] = [521,463]
- when 2
- @tagmap[36] = [61,470,28,33,8]
- @placemap[36] = [61,470]
- end
- @allmap_id = $game_variables[ALLMAP]
- @focus = 0
- @map_id = $game_map.map_id
- @tag_lock = false
- $mapdamage_obj.clear if $mapdamage_obj != nil && !$mapdamage_obj.canvas[1].disposed?
- $mapchest_obj.clear if $mapchest_obj != nil && !$mapchest_obj.canvas[1].disposed?
- $mapplayerbuff_obj.clear if $mapplayerbuff_obj != nil
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 创建背景
- @back = Sprite.new
- case $game_variables[451]
- when -1
- @back.bitmap = Bitmap.new("Graphics/Systems/世界地图")
- when 0
- @back.bitmap = Bitmap.new("Graphics/Systems/地下水路")
- when 1
- @back.bitmap = Bitmap.new("Graphics/Systems/落岩崖")
- when 2
- @back.bitmap = Bitmap.new("Graphics/Systems/列车")
- end
- # 创建X轴
- @mm_x = Sprite.new
- @mm_x.bitmap = Bitmap.new("Graphics/Systems/mm_x")
- @mm_x.y = 0
- @mm_x.y = @placemap[@map_id][1] if @placemap[@map_id]!=nil
- # 创建Y轴
- @mm_y = Sprite.new
- @mm_y.bitmap = Bitmap.new("Graphics/Systems/mm_y")
- @mm_y.x = 0
- @mm_y.x = @placemap[@map_id][0] if @placemap[@map_id]!=nil
- # 创建地点缩略图
- @mm_icon = Sprite.new
- @mm_icon.bitmap = Bitmap.new("Graphics/Systems/Icon/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- @mm_icon.x = 0
- @mm_icon.y = 144
- # 创建地名
- @mm_name = Sprite.new
- if $game_variables[451]==-1
- @mm_name.bitmap = Bitmap.new("Graphics/Systems/mapname/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- else
- @mm_name.bitmap = Bitmap.new("Graphics/Systems/Name/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- end
- @mm_name.x = 0
- @mm_name.y = 320
- if $game_variables[451]==-1
- @mm_icon.x = 32
- @mm_icon.y = 224
- @mm_name.x = 32
- @mm_name.y = 416
- elsif $game_variables[451]==1
- @mm_icon.x = 32
- @mm_icon.y = 112
- @mm_name.x = 32
- @mm_name.y = 304
- elsif $game_variables[451]==2
- @mm_icon.x = 224
- @mm_icon.y = 64
- @mm_name.x = 72
- @mm_name.y = 32
- end
- # 执行过度
- Graphics.transition(30, "Graphics/Transitions/019-Whorl01" )
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换就中断循环
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- # 释放窗口
- @back.dispose
- @mm_x.dispose
- @mm_y.dispose
- @mm_name.dispose
- @mm_icon.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- @mm_icon.bitmap = Bitmap.new("Graphics/Systems/Icon/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- if $game_variables[451]==-1
- @mm_name.bitmap = Bitmap.new("Graphics/Systems/mapname/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- else
- @mm_name.bitmap = Bitmap.new("Graphics/Systems/Name/"+@map_id.to_s) if @tagmap[@map_id]!=nil
- end
- disjudge
- # 按下 X 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- #值可以随便定,但是要比校正范围小一定的值。
- if Input.press?(Input::LEFT)
- if @mm_y.x>0
- @mm_y.x -= 3
- end
- end
- if Input.press?(Input::RIGHT)
- if @mm_y.x<640
- @mm_y.x += 3
- end
- end
- if Input.press?(Input::UP)
- if @mm_x.y>0
- @mm_x.y -= 3
- end
- end
- if Input.press?(Input::DOWN)
- if @mm_x.y<480
- @mm_x.y += 3
- end
- end
- if Input.trigger?(Input::C)
- if @tag_lock && $game_variables[OPENMAP].include?(@map_id)
- $game_system.se_play($data_system.decision_se)
- $game_screen.start_tone_change(Tone.new(-255,-255,-255,0), 0)
- $scene = Scene_Map.new
- $game_temp.player_transferring = true
- case @map_id
- when 11
- $game_variables[2]="地下水路 上层"
- $game_variables[451]=0
- $game_switches[200]=true
- $game_variables[198]=96
- when 14
- $game_variables[2]="地下水路 中层"
- when 17
- $game_variables[2]="地下水路 下层"
- when 20
- $game_variables[2]="马德莱镇"
- $game_variables[451]=-2
- $game_switches[200]=false
- $game_variables[198]=72
- when 24
- $game_variables[2]="落岩崖 崖口"
- $game_variables[451]=1
- $game_switches[200]=true
- $game_variables[198]=64
- when 26,30
- $game_variables[2]="落岩崖 兽道"
- when 27
- $game_variables[2]="落岩崖 崩落道"
- when 32
- $game_variables[2]="咸鱼金字塔"
- when 36
- $game_variables[2]="没有人在的站台"
- $game_variables[451]=2
- $game_switches[200]=true
- $game_variables[198]=64
- when 33,37
- $game_variables[2]="魔导列车 后车厢"
- when 39
- $game_variables[2]="魔导列车 前车厢"
- when 44
- $game_variables[2]="法影之地"
- end
- $game_temp.player_new_map_id = @map_id
- $game_temp.player_new_x=@tagmap[@map_id][2]
- $game_temp.player_new_y=@tagmap[@map_id][3]
- $game_temp.player_new_direction = @tagmap[@map_id][4]
- $game_screen.start_tone_change(Tone.new(0,0,0,0), 10)
- else
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 实时判断
- #--------------------------------------------------------------------------
- def disjudge
- for i in @allmap_id
- ax = @tagmap[i][0]
- ay = @tagmap[i][1]
- x = @mm_y.x
- y = @mm_x.y
- f = FR**2
- dis = (x-ax)**2 + (y-ay)**2
- #自动校正范围,默认16个像素,根据大地图来定。
- if dis <= f
- if x> ax
- @mm_y.x-=1
- elsif x< ax
- @mm_y.x+=1
- end
- if y> ay
- @mm_x.y-=1
- elsif y< ay
- @mm_x.y+=1
- end
- @map_id = i
- end
- if @tagmap[@map_id]!=nil
- dis2 = (x-@tagmap[@map_id][0])**2 + (y-@tagmap[@map_id][1])**2
- if dis2 < f
- @tag_lock = true
- else
- @tag_lock = false
- end
- end
- end
- end
- end
复制代码
代码来自《晴空狂想曲》,作者:阻激夹域
增设了多张大地图的功能~ |
|