赞 | 3 |
VIP | 32 |
好人卡 | 0 |
积分 | 1 |
经验 | 14756 |
最后登录 | 2021-5-30 |
在线时间 | 579 小时 |
Lv1.梦旅人 小小的百鬼夜行<
- 梦石
- 0
- 星屑
- 54
- 在线时间
- 579 小时
- 注册时间
- 2010-7-29
- 帖子
- 2682
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 退屈£无聊 于 2011-8-17 13:04 编辑
菜单计划一看这里:http://rpg.blue/thread-202640-1-1.html
前言不再重复,外援脚本还是要用到的。
全程未PS,效率各种渣
效果截图:附加了一个简单的物品分类= =
脚本正文:
part1:- class Scene_Item
- def initialize
- end
- def main
- @bitmap = Spriteset_Map.new
- @z = Sprite.new
- @z.bitmap = Bitmap.new(640, 480)
- @z.bitmap.fill_rect(0,0,640,480,Color.new(0,0,0,150))
- @z.bitmap.fill_rect(25,100,590,4,Color.new(255,255,255))
- choose_bitmap = Bitmap.new(100,40)
- choose_bitmap.font.size = 40
- for i in 0...50
- choose_bitmap.draw_text(i,0,100,40,"●")
- end
- @choose = Sprite.new
- @choose.bitmap = choose_bitmap
- @choose.x = 300
- @choose.y = 60
- @choose_text = Sprite.new
- @choose_text.x = 300
- @choose_text.y = 60
- @choose_text.bitmap = Bitmap.new(640,40)
- @choose_text.bitmap.font.size = 20
- @choose_text.bitmap.font.color = Color.new(0,0,0)
- @choose_text.bitmap.draw_text(0,0,90,40,"全部",1)
- @help = Sprite.new
- @help.bitmap = Bitmap.new(510, 20)
- @help.x = 65
- @help.y = 450
- @help_text = Sprite.new
- @help_text.bitmap = Bitmap.new(510, 20)
- @help_text.bitmap.font.name = "宋体"
- @help_text.bitmap.font.size = 13
- @help_text.x = 65
- @help_text.y = 450
- for i in 0..255/5
- @help.bitmap.fill_rect(i*5,0,5,20,Color.new(0,0,0,i*5))
- @help.bitmap.fill_rect(510-i*5,0,5,20,Color.new(0,0,0,i*5))
- @help.bitmap.fill_rect(i*5, 0, 5, 1, Color.new(255,255,255,i*5))
- @help.bitmap.fill_rect(510-i*5, 0, 5, 1, Color.new(255,255,255,i*5))
- @help.bitmap.fill_rect(i*5, 19, 5, 1, Color.new(255,255,255,i*5))
- @help.bitmap.fill_rect(510-i*5, 19, 5, 1, Color.new(255,255,255,i*5))
- end
- a = 70
- draw_item.each {|b| @choose_text.bitmap.draw_text(a,0,90,40,b,1)
- a += 70}
- @c_index = 0
- @index = 0
- @page = 0
- @person = []
- viewport = Viewport.new(10,36,130,408)
- #=================================================================
- $game_party.actors.each_index {|a|
- @person[a] = RPG::Sprite.new(viewport)
- @person[a].bitmap = Bitmap.new(130,416)
- @person[a].bitmap.blt(0,0,
- Bitmap.new("Graphics/Menu/#{$game_party.actors[a].name}"),
- Rect.new(0,0,640,480))
- @person[a].x = a * 130
- @person[a].bitmap.fill_rect(23, 360, 92, 3, Color.new(0,0,0))
- @person[a].bitmap.fill_rect(23, 370, 92, 3, Color.new(0,0,0))
- @person[a].bitmap.fill_rect(24, 361,
- (90*$game_party.actors[a].hp / $game_party.actors[a].maxhp).to_i, 1, Color.new(200,0,0))
- @person[a].bitmap.fill_rect(24, 371,
- (90*$game_party.actors[a].sp / $game_party.actors[a].maxsp).to_i, 1, Color.new(0,0,200))
- @person[a].bitmap.font.size = 11
- @person[a].bitmap.blur_draw_text(10, 350, 30, 20,
- "HP",1,Color.new(0,0,0,10),2)
- @person[a].bitmap.blur_draw_text(40, 350, 70, 20,
- "#{$game_party.actors[a].hp}/#{$game_party.actors[a].maxhp}",
- 1,Color.new(0,0,0,10),2)
- @person[a].bitmap.blur_draw_text(10, 360, 30, 20,
- "SP",1,Color.new(0,0,0,10),2)
- @person[a].bitmap.blur_draw_text(40, 360, 70, 20,
- "#{$game_party.actors[a].sp}/#{$game_party.actors[a].maxsp}",
- 1,Color.new(0,0,0,10),2)
- b = $game_party.actors[a].name.scan(/./)
- b << "Lv"
- b << $game_party.actors[a].level.to_s
- @person[a].bitmap.font.size = 30
- b.each_index {|c| @person[a].bitmap.blur_draw_text(90, 50+30*c, 30, 30,
- b[c],2,Color.new(0,0,0,10),2)}}
- #================================================
- @status = false
- @s_index = 0
- @help_text.bitmap.clear
- if @data[@c_index][@index] != nil
- @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
- end
- loop {update;break if $scene != self}
- @choose_text.bitmap.dispose
- @choose_text.dispose
- @choose.bitmap.dispose
- @choose.dispose
- @item.each {|a| a.bitmap.dispose;a.dispose}
- @z.bitmap.dispose;@z.dispose
- @bitmap.dispose
- end
- def update
- Graphics.update
- @iback.update
- @person.each {|a| a.blink_on if !a.blink?;a.update} if @status
- update_status if @status
- update_input if !@status
- @person.each {|a| a.blink_off} if !@status && @person[0].blink?
- end
- def update_input
- Input.update
- c_change(true) if Input.trigger?(Input::RIGHT)
- c_change if Input.trigger?(Input::LEFT)
- index_change(true) if Input.trigger?(Input::DOWN)
- index_change if Input.trigger?(Input::UP)
- $scene = Scene_Menu.new if Input.trigger?(Input::B)
- use_item if Input.trigger?(Input::C)
- end
- def c_change(plus=false)
- if plus
- return if @c_index >= @item.size - 1
- @page = 0
- @item[@c_index].y = 0
- @item_back[@c_index].y = 0
- @iback.y = 4
- @c_index += 1
- for i in 0...10
- @choose.x += 7
- @item.each {|a| a.x -= 30}
- @item_back.each {|a| a.x -= 30}
- Graphics.update
- end
- else
- return if @c_index <= 0
- @page = 0
- @item[@c_index].y = 0
- @item_back[@c_index].y = 0
- @iback.y = 4
- @c_index -= 1
- for i in 0...10
- @choose.x -= 7
- @item.each {|a| a.x += 30}
- @item_back.each {|a| a.x += 30}
- Graphics.update
- end
- end
- @index = 0
- @help_text.bitmap.clear
- if @data[@c_index][@index] != nil
- @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
- end
- end
- def index_change(plus=false)
- if plus
- return if @index >= @max[@c_index] - 1
- page(true) if @index >= 9 + @page
- @index += 1
- @iback.y = 4 + @index * 30 - @page * 30
- else
- return if @index <= 0
- page if @index <= @page
- @index -= 1
- @iback.y = 4 + @index * 30 - @page * 30
- end
- @help_text.bitmap.clear
- if @data[@c_index][@index] != nil
- @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
- end
- end
- def page(plus=false)
- if plus
- @page += 1
- @item[@c_index].y -= 30
- @item_back[@c_index].y -= 30
- else
- return if @page <= 0
- @page -= 1
- @item[@c_index].y += 30
- @item_back[@c_index].y += 30
- end
- end
- def draw_item
- @data = []
- @item = []
- @item_back = []
- b = []
- @data.push([])
- @data.push([])
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data[0].push($data_items[i])
- @data[@data.size-1].push($data_items[i])
- b.push("物品") if !b.include?("物品")
- end
- end
- @data.delete_at(@data.size-1) if @data[@data.size-1] == []
- @data.push([])
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data[0].push($data_weapons[i])
- @data[@data.size-1].push($data_weapons[i])
- b.push("武器") if !b.include?("武器")
- end
- end
- @data.delete_at(@data.size-1) if @data[@data.size-1] == []
- @data.push([])
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data[0].push($data_armors[i])
- @data[@data.size-1].push($data_armors[i])
- b.push("防具") if !b.include?("防具")
- end
- end
- @data.delete_at(@data.size-1) if @data[@data.size-1] == []
- bitmap = Bitmap.new(300,22)
- bitmap.font.size = 22
- bitmap.font.color = Color.new(0,0,0)
- for i in 0...250
- bitmap.draw_text(i,0,22,22,"●")
- end
- viewport = Viewport.new(290,120,300,300)
- @iback = RPG::Sprite.new(viewport)
- @iback.bitmap = bitmap
- @iback.blink_on
- @iback.z = 8000
- @iback.y = 4
- for i in [email protected]
- @item_back[i] = Sprite.new(viewport)
- @item_back[i].bitmap = Bitmap.new(640,480)
- @item_back[i].x = i * 300
- @item_back[i].opacity = 50
- @item[i] = Sprite.new(viewport)
- @item[i].bitmap = Bitmap.new(640,480)
- @item[i].bitmap.font.size = 14
- @item[i].x = i * 300
- @item[i].z = 9999
- end
- @max = []
- @max[0] = 0
- d = 0
- @data.each_index {|a| d = 0 ;@max[a] = 0 ; @data[a].each{|c|
- @item_back[a].bitmap.blt(0,d+4,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
- @item[a].bitmap.blt(10,d+2,RPG::Cache.icon(c.icon_name),Rect.new(0,0,32,22))
- @item[a].bitmap.draw_text(40,d,300,30,c.name)
- case c
- when RPG::Item
- f = $game_party.item_number(c.id)
- when RPG::Weapon
- f = $game_party.weapon_number(c.id)
- when RPG::Armor
- f = $game_party.armor_number(c.id)
- end
- @item[a].bitmap.draw_text(0,d,252,30,f.to_s, 2)
- @max[a] += 1
- d += 30}}
- return b
- end
- def use_draw_item
- rect = Rect.new(0,@index * 30,640,30)
- @item[@c_index].bitmap.fill_rect(rect, Color.new(0,0,0,0))
- @item[@c_index].bitmap.blt(10,rect.y+2,
- RPG::Cache.icon(@data[@c_index][@index].icon_name),Rect.new(0,0,32,22))
- @item[@c_index].bitmap.draw_text(40,rect.y,300,30,@data[@c_index][@index].name)
- case @data[@c_index][@index]
- when RPG::Item
- f = $game_party.item_number(@data[@c_index][@index].id)
- when RPG::Weapon
- f = $game_party.weapon_number(@data[@c_index][@index].id)
- when RPG::Armor
- f = $game_party.armor_number(@data[@c_index][@index].id)
- end
- @item[@c_index].bitmap.draw_text(0,rect.y,252,30,f.to_s, 2)
- end
- end
复制代码 part2:- class Scene_Item
- def use_item
- @item_use = @data[@c_index][@index]
- unless @item_use.is_a?(RPG::Item)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- unless $game_party.item_can_use?(@item_use.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @item_use.scope >= 3
- if @item_use.scope == 4 || @item_use.scope == 6
- @target_window.index = -1
- if $game_party.item_number(@item_use.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item_use)
- @person[@s_index].flash(Color.new(255,255,255,100),10)
- end
- if @item_use.consumable
- $game_party.lose_item(@item_use.id, 1)
- use_draw_item
- end
- else
- @status = true
- end
- else
- if @item_use.common_event_id > 0
- $game_temp.common_event_id = @item_use.common_event_id
- $game_system.se_play(@item_use.menu_se)
- if @item_use.consumable
- $game_party.lose_item(@item_use.id, 1)
- use_draw_item
- end
- $scene = Scene_Map.new
- return
- end
- end
- end
- def update_status
- Input.update
- change_s if Input.trigger?(Input::LEFT)
- change_s(true) if Input.trigger?(Input::RIGHT)
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- unless $game_party.item_can_use?(@item_use.id)
- end
- @status = false
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.item_number(@item_use.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- @status = false
- return
- end
- if @s_index >= 0
- target = $game_party.actors[@s_index]
- used = target.item_effect(@item_use)
- end
- if used
- $game_system.se_play(@item_use.menu_se)
- if @item_use.consumable
- $game_party.lose_item(@item_use.id, 1)
- use_draw_item
- end
- refresh_status
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- @status = false
- return
- end
- if @item_use.common_event_id > 0
- $game_temp.common_event_id = @item_use.common_event_id
- if @item_use.consumable
- $game_party.lose_item(@item_use.id, 1)
- use_draw_item
- end
- $scene = Scene_Map.new
- @status = false
- return
- end
- end
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- @status = false
- return
- end
- end
- def refresh_status
- @person[@s_index].bitmap.clear
- @person[@s_index].bitmap.blt(0,0,
- Bitmap.new("Graphics/Menu/#{$game_party.actors[@s_index].name}"),
- Rect.new(0,0,640,480))
- @person[@s_index].bitmap.fill_rect(23, 360, 92, 3, Color.new(0,0,0))
- @person[@s_index].bitmap.fill_rect(23, 370, 92, 3, Color.new(0,0,0))
- @person[@s_index].bitmap.fill_rect(24, 361,
- (90*$game_party.actors[@s_index].hp / $game_party.actors[@s_index].maxhp).to_i, 1, Color.new(200,0,0))
- @person[@s_index].bitmap.fill_rect(24, 371,
- (90*$game_party.actors[@s_index].sp / $game_party.actors[@s_index].maxsp).to_i, 1, Color.new(0,0,200))
- @person[@s_index].bitmap.font.size = 11
- @person[@s_index].bitmap.blur_draw_text(10, 350, 30, 20,
- "HP",1,Color.new(0,0,0,10),2)
- @person[@s_index].bitmap.blur_draw_text(40, 350, 70, 20,
- "#{$game_party.actors[@s_index].hp}/#{$game_party.actors[@s_index].maxhp}",
- 1,Color.new(0,0,0,10),2)
- @person[@s_index].bitmap.blur_draw_text(10, 360, 30, 20,
- "SP",1,Color.new(0,0,0,10),2)
- @person[@s_index].bitmap.blur_draw_text(40, 360, 70, 20,
- "#{$game_party.actors[@s_index].sp}/#{$game_party.actors[@s_index].maxsp}",
- 1,Color.new(0,0,0,10),2)
- b = $game_party.actors[@s_index].name.scan(/./)
- b << "Lv"
- b << $game_party.actors[@s_index].level.to_s
- @person[@s_index].bitmap.font.size = 30
- b.each_index {|c| @person[@s_index].bitmap.blur_draw_text(90, 50+30*c, 30, 30,
- b[c],2,Color.new(0,0,0,10),2)}
- end
- def change_s(plus=false)
- if plus
- return if @s_index >= @person.size-1
- @s_index += 1
- for i in 0...10
- @person.each {|a| a.x -= 13}
- Graphics.update
- end
- else
- return if @s_index <= 0
- @s_index -= 1
- for i in 0...10
- @person.each {|a| a.x += 13}
- Graphics.update
- end
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|