设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3498|回复: 7
打印 上一主题 下一主题

[原创发布] 蛐蛐儿的简约(渣)菜单计划(二)

[复制链接]

Lv1.梦旅人

小小的百鬼夜行<

梦石
0
星屑
54
在线时间
579 小时
注册时间
2010-7-29
帖子
2682

贵宾

跳转到指定楼层
1
发表于 2011-8-17 12:13:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 退屈£无聊 于 2011-8-17 13:04 编辑

菜单计划一看这里:http://rpg.blue/thread-202640-1-1.html
前言不再重复,外援脚本还是要用到的。
全程未PS,效率各种渣


效果截图:附加了一个简单的物品分类= =




脚本正文:
part1:
  1. class Scene_Item
  2.   def initialize
  3.   end
  4.   def main
  5.     @bitmap = Spriteset_Map.new
  6.     @z = Sprite.new
  7.     @z.bitmap = Bitmap.new(640, 480)
  8.     @z.bitmap.fill_rect(0,0,640,480,Color.new(0,0,0,150))
  9.     @z.bitmap.fill_rect(25,100,590,4,Color.new(255,255,255))
  10.     choose_bitmap = Bitmap.new(100,40)
  11.     choose_bitmap.font.size = 40
  12.     for i in 0...50
  13.       choose_bitmap.draw_text(i,0,100,40,"●")
  14.     end
  15.     @choose = Sprite.new
  16.     @choose.bitmap = choose_bitmap
  17.     @choose.x = 300
  18.     @choose.y = 60
  19.     @choose_text = Sprite.new
  20.     @choose_text.x = 300
  21.     @choose_text.y = 60
  22.     @choose_text.bitmap = Bitmap.new(640,40)
  23.     @choose_text.bitmap.font.size = 20
  24.     @choose_text.bitmap.font.color = Color.new(0,0,0)
  25.     @choose_text.bitmap.draw_text(0,0,90,40,"全部",1)
  26.     @help = Sprite.new
  27.     @help.bitmap = Bitmap.new(510, 20)
  28.     @help.x = 65
  29.     @help.y = 450
  30.     @help_text = Sprite.new
  31.     @help_text.bitmap = Bitmap.new(510, 20)
  32.     @help_text.bitmap.font.name = "宋体"
  33.     @help_text.bitmap.font.size = 13
  34.     @help_text.x = 65
  35.     @help_text.y = 450
  36.     for i in 0..255/5
  37.       @help.bitmap.fill_rect(i*5,0,5,20,Color.new(0,0,0,i*5))
  38.       @help.bitmap.fill_rect(510-i*5,0,5,20,Color.new(0,0,0,i*5))
  39.       @help.bitmap.fill_rect(i*5, 0, 5, 1, Color.new(255,255,255,i*5))
  40.       @help.bitmap.fill_rect(510-i*5, 0, 5, 1, Color.new(255,255,255,i*5))
  41.       @help.bitmap.fill_rect(i*5, 19, 5, 1, Color.new(255,255,255,i*5))
  42.       @help.bitmap.fill_rect(510-i*5, 19, 5, 1, Color.new(255,255,255,i*5))
  43.     end
  44.     a = 70
  45.     draw_item.each {|b| @choose_text.bitmap.draw_text(a,0,90,40,b,1)
  46.     a += 70}
  47.     @c_index = 0
  48.     @index = 0
  49.     @page = 0
  50.     @person = []
  51.     viewport = Viewport.new(10,36,130,408)
  52.     #=================================================================
  53.     $game_party.actors.each_index {|a|
  54.     @person[a] = RPG::Sprite.new(viewport)
  55.     @person[a].bitmap = Bitmap.new(130,416)
  56.     @person[a].bitmap.blt(0,0,
  57.     Bitmap.new("Graphics/Menu/#{$game_party.actors[a].name}"),
  58.     Rect.new(0,0,640,480))
  59.     @person[a].x = a * 130
  60.     @person[a].bitmap.fill_rect(23, 360, 92, 3, Color.new(0,0,0))
  61.     @person[a].bitmap.fill_rect(23, 370, 92, 3, Color.new(0,0,0))
  62.     @person[a].bitmap.fill_rect(24, 361,
  63.     (90*$game_party.actors[a].hp / $game_party.actors[a].maxhp).to_i, 1, Color.new(200,0,0))
  64.     @person[a].bitmap.fill_rect(24, 371,
  65.     (90*$game_party.actors[a].sp / $game_party.actors[a].maxsp).to_i, 1, Color.new(0,0,200))
  66.     @person[a].bitmap.font.size = 11
  67.     @person[a].bitmap.blur_draw_text(10, 350, 30, 20,
  68.     "HP",1,Color.new(0,0,0,10),2)
  69.     @person[a].bitmap.blur_draw_text(40, 350, 70, 20,
  70.     "#{$game_party.actors[a].hp}/#{$game_party.actors[a].maxhp}",
  71.     1,Color.new(0,0,0,10),2)
  72.     @person[a].bitmap.blur_draw_text(10, 360, 30, 20,
  73.     "SP",1,Color.new(0,0,0,10),2)
  74.     @person[a].bitmap.blur_draw_text(40, 360, 70, 20,
  75.     "#{$game_party.actors[a].sp}/#{$game_party.actors[a].maxsp}",
  76.     1,Color.new(0,0,0,10),2)
  77.     b = $game_party.actors[a].name.scan(/./)
  78.     b << "Lv"
  79.     b << $game_party.actors[a].level.to_s
  80.     @person[a].bitmap.font.size = 30
  81.     b.each_index {|c| @person[a].bitmap.blur_draw_text(90, 50+30*c, 30, 30,
  82.     b[c],2,Color.new(0,0,0,10),2)}}
  83.     #================================================
  84.     @status = false
  85.     @s_index = 0
  86.     @help_text.bitmap.clear
  87.     if @data[@c_index][@index] != nil
  88.       @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
  89.     end
  90.     loop {update;break if $scene != self}
  91.     @choose_text.bitmap.dispose
  92.     @choose_text.dispose
  93.     @choose.bitmap.dispose
  94.     @choose.dispose
  95.     @item.each {|a| a.bitmap.dispose;a.dispose}
  96.     @z.bitmap.dispose;@z.dispose
  97.     @bitmap.dispose
  98.   end
  99.   def update
  100.     Graphics.update
  101.     @iback.update
  102.     @person.each {|a| a.blink_on if !a.blink?;a.update} if @status
  103.     update_status if @status
  104.     update_input if !@status
  105.     @person.each {|a| a.blink_off} if !@status && @person[0].blink?
  106.   end
  107.   def update_input
  108.     Input.update
  109.     c_change(true) if Input.trigger?(Input::RIGHT)
  110.     c_change if Input.trigger?(Input::LEFT)
  111.     index_change(true) if Input.trigger?(Input::DOWN)
  112.     index_change if Input.trigger?(Input::UP)
  113.     $scene = Scene_Menu.new if Input.trigger?(Input::B)
  114.     use_item if Input.trigger?(Input::C)
  115.   end
  116.   def c_change(plus=false)
  117.     if plus
  118.       return if @c_index >= @item.size - 1
  119.       @page = 0
  120.       @item[@c_index].y = 0
  121.       @item_back[@c_index].y = 0
  122.       @iback.y = 4
  123.       @c_index += 1
  124.       for i in 0...10
  125.         @choose.x += 7
  126.         @item.each {|a| a.x -= 30}
  127.         @item_back.each {|a| a.x -= 30}
  128.         Graphics.update
  129.       end
  130.     else
  131.       return if @c_index <= 0
  132.       @page = 0
  133.       @item[@c_index].y = 0
  134.       @item_back[@c_index].y = 0
  135.       @iback.y = 4
  136.       @c_index -= 1
  137.       for i in 0...10
  138.         @choose.x -= 7
  139.         @item.each {|a| a.x += 30}
  140.         @item_back.each {|a| a.x += 30}
  141.         Graphics.update
  142.       end
  143.     end
  144.     @index = 0
  145.     @help_text.bitmap.clear
  146.     if @data[@c_index][@index] != nil
  147.       @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
  148.     end
  149.   end
  150.   def index_change(plus=false)
  151.     if plus
  152.       return if @index >= @max[@c_index] - 1
  153.       page(true) if @index >= 9 + @page
  154.       @index += 1
  155.       @iback.y = 4 + @index * 30 - @page * 30
  156.     else
  157.       return if @index <= 0
  158.       page if @index <= @page
  159.       @index -= 1
  160.       @iback.y = 4 + @index * 30 - @page * 30
  161.     end
  162.     @help_text.bitmap.clear
  163.     if @data[@c_index][@index] != nil
  164.       @help_text.bitmap.draw_text(0,0,510,20,@data[@c_index][@index].description,1)
  165.     end
  166.   end
  167.   def page(plus=false)
  168.     if plus
  169.       @page += 1
  170.       @item[@c_index].y -= 30
  171.       @item_back[@c_index].y -= 30
  172.     else
  173.       return if @page <= 0
  174.       @page -= 1
  175.       @item[@c_index].y += 30
  176.       @item_back[@c_index].y += 30
  177.     end
  178.   end
  179.   def draw_item
  180.     @data = []
  181.     @item = []
  182.     @item_back = []
  183.     b = []
  184.     @data.push([])
  185.     @data.push([])
  186.     for i in 1...$data_items.size
  187.       if $game_party.item_number(i) > 0
  188.         @data[0].push($data_items[i])
  189.         @data[@data.size-1].push($data_items[i])
  190.         b.push("物品") if !b.include?("物品")
  191.       end
  192.     end
  193.     @data.delete_at(@data.size-1) if @data[@data.size-1] == []
  194.     @data.push([])
  195.     for i in 1...$data_weapons.size
  196.       if $game_party.weapon_number(i) > 0
  197.         @data[0].push($data_weapons[i])
  198.         @data[@data.size-1].push($data_weapons[i])
  199.         b.push("武器") if !b.include?("武器")
  200.       end
  201.     end
  202.     @data.delete_at(@data.size-1) if @data[@data.size-1] == []
  203.     @data.push([])
  204.     for i in 1...$data_armors.size
  205.       if $game_party.armor_number(i) > 0
  206.         @data[0].push($data_armors[i])
  207.         @data[@data.size-1].push($data_armors[i])
  208.         b.push("防具") if !b.include?("防具")
  209.       end
  210.     end
  211.     @data.delete_at(@data.size-1) if @data[@data.size-1] == []
  212.     bitmap = Bitmap.new(300,22)
  213.     bitmap.font.size = 22
  214.     bitmap.font.color = Color.new(0,0,0)
  215.     for i in 0...250
  216.       bitmap.draw_text(i,0,22,22,"●")
  217.     end
  218.     viewport = Viewport.new(290,120,300,300)
  219.     @iback = RPG::Sprite.new(viewport)
  220.     @iback.bitmap = bitmap
  221.     @iback.blink_on
  222.     @iback.z = 8000
  223.     @iback.y = 4
  224.     for i in [email protected]
  225.       @item_back[i] = Sprite.new(viewport)
  226.       @item_back[i].bitmap = Bitmap.new(640,480)
  227.       @item_back[i].x = i * 300
  228.       @item_back[i].opacity = 50
  229.       @item[i] = Sprite.new(viewport)
  230.       @item[i].bitmap = Bitmap.new(640,480)
  231.       @item[i].bitmap.font.size = 14
  232.       @item[i].x = i * 300
  233.       @item[i].z = 9999
  234.     end
  235.     @max = []
  236.     @max[0] = 0
  237.     d = 0
  238.     @data.each_index {|a| d = 0 ;@max[a] = 0 ; @data[a].each{|c|
  239.     @item_back[a].bitmap.blt(0,d+4,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
  240.     @item[a].bitmap.blt(10,d+2,RPG::Cache.icon(c.icon_name),Rect.new(0,0,32,22))
  241.     @item[a].bitmap.draw_text(40,d,300,30,c.name)
  242.     case c
  243.     when RPG::Item
  244.       f = $game_party.item_number(c.id)
  245.     when RPG::Weapon
  246.       f = $game_party.weapon_number(c.id)
  247.     when RPG::Armor
  248.       f = $game_party.armor_number(c.id)
  249.     end
  250.     @item[a].bitmap.draw_text(0,d,252,30,f.to_s, 2)
  251.     @max[a] += 1
  252.     d += 30}}
  253.     return b
  254.   end
  255.   def use_draw_item
  256.     rect = Rect.new(0,@index * 30,640,30)
  257.     @item[@c_index].bitmap.fill_rect(rect, Color.new(0,0,0,0))
  258.     @item[@c_index].bitmap.blt(10,rect.y+2,
  259.     RPG::Cache.icon(@data[@c_index][@index].icon_name),Rect.new(0,0,32,22))
  260.     @item[@c_index].bitmap.draw_text(40,rect.y,300,30,@data[@c_index][@index].name)
  261.     case @data[@c_index][@index]
  262.     when RPG::Item
  263.       f = $game_party.item_number(@data[@c_index][@index].id)
  264.     when RPG::Weapon
  265.       f = $game_party.weapon_number(@data[@c_index][@index].id)
  266.     when RPG::Armor
  267.       f = $game_party.armor_number(@data[@c_index][@index].id)
  268.     end
  269.     @item[@c_index].bitmap.draw_text(0,rect.y,252,30,f.to_s, 2)
  270.   end
  271. end
复制代码
part2:
  1. class Scene_Item
  2.   def use_item
  3.     @item_use = @data[@c_index][@index]
  4.     unless @item_use.is_a?(RPG::Item)
  5.       $game_system.se_play($data_system.buzzer_se)
  6.       return
  7.     end
  8.     unless $game_party.item_can_use?(@item_use.id)
  9.       $game_system.se_play($data_system.buzzer_se)
  10.       return
  11.     end
  12.     $game_system.se_play($data_system.decision_se)
  13.     if @item_use.scope >= 3
  14.       if @item_use.scope == 4 || @item_use.scope == 6
  15.         @target_window.index = -1
  16.         if $game_party.item_number(@item_use.id) == 0
  17.           $game_system.se_play($data_system.buzzer_se)
  18.           return
  19.         end
  20.         used = false
  21.         for i in $game_party.actors
  22.           used |= i.item_effect(@item_use)
  23.           @person[@s_index].flash(Color.new(255,255,255,100),10)
  24.         end
  25.         if @item_use.consumable
  26.           $game_party.lose_item(@item_use.id, 1)
  27.           use_draw_item
  28.         end
  29.       else
  30.         @status = true
  31.       end
  32.     else
  33.       if @item_use.common_event_id > 0
  34.         $game_temp.common_event_id = @item_use.common_event_id
  35.         $game_system.se_play(@item_use.menu_se)
  36.         if @item_use.consumable
  37.           $game_party.lose_item(@item_use.id, 1)
  38.           use_draw_item
  39.         end
  40.         $scene = Scene_Map.new
  41.         return
  42.       end
  43.     end
  44.   end
  45.   def update_status
  46.     Input.update
  47.     change_s if Input.trigger?(Input::LEFT)
  48.     change_s(true) if Input.trigger?(Input::RIGHT)
  49.     if Input.trigger?(Input::B)
  50.       $game_system.se_play($data_system.cancel_se)
  51.       unless $game_party.item_can_use?(@item_use.id)
  52.       end
  53.       @status = false
  54.       return
  55.     end
  56.     if Input.trigger?(Input::C)
  57.       if $game_party.item_number(@item_use.id) == 0
  58.         $game_system.se_play($data_system.buzzer_se)
  59.         @status = false
  60.         return
  61.       end
  62.       if @s_index >= 0
  63.         target = $game_party.actors[@s_index]
  64.         used = target.item_effect(@item_use)
  65.       end
  66.       if used
  67.         $game_system.se_play(@item_use.menu_se)
  68.         if @item_use.consumable
  69.           $game_party.lose_item(@item_use.id, 1)
  70.           use_draw_item
  71.         end
  72.         refresh_status
  73.         if $game_party.all_dead?
  74.           $scene = Scene_Gameover.new
  75.           @status = false
  76.           return
  77.         end
  78.         if @item_use.common_event_id > 0
  79.           $game_temp.common_event_id = @item_use.common_event_id
  80.           if @item_use.consumable
  81.             $game_party.lose_item(@item_use.id, 1)
  82.             use_draw_item
  83.           end
  84.           $scene = Scene_Map.new
  85.           @status = false
  86.           return
  87.         end
  88.       end
  89.       unless used
  90.         $game_system.se_play($data_system.buzzer_se)
  91.       end
  92.       @status = false
  93.       return
  94.     end
  95.   end
  96.   def refresh_status
  97.     @person[@s_index].bitmap.clear
  98.     @person[@s_index].bitmap.blt(0,0,
  99.     Bitmap.new("Graphics/Menu/#{$game_party.actors[@s_index].name}"),
  100.     Rect.new(0,0,640,480))
  101.     @person[@s_index].bitmap.fill_rect(23, 360, 92, 3, Color.new(0,0,0))
  102.     @person[@s_index].bitmap.fill_rect(23, 370, 92, 3, Color.new(0,0,0))
  103.     @person[@s_index].bitmap.fill_rect(24, 361,
  104.     (90*$game_party.actors[@s_index].hp / $game_party.actors[@s_index].maxhp).to_i, 1, Color.new(200,0,0))
  105.     @person[@s_index].bitmap.fill_rect(24, 371,
  106.     (90*$game_party.actors[@s_index].sp / $game_party.actors[@s_index].maxsp).to_i, 1, Color.new(0,0,200))
  107.     @person[@s_index].bitmap.font.size = 11
  108.     @person[@s_index].bitmap.blur_draw_text(10, 350, 30, 20,
  109.     "HP",1,Color.new(0,0,0,10),2)
  110.     @person[@s_index].bitmap.blur_draw_text(40, 350, 70, 20,
  111.     "#{$game_party.actors[@s_index].hp}/#{$game_party.actors[@s_index].maxhp}",
  112.     1,Color.new(0,0,0,10),2)
  113.     @person[@s_index].bitmap.blur_draw_text(10, 360, 30, 20,
  114.     "SP",1,Color.new(0,0,0,10),2)
  115.     @person[@s_index].bitmap.blur_draw_text(40, 360, 70, 20,
  116.     "#{$game_party.actors[@s_index].sp}/#{$game_party.actors[@s_index].maxsp}",
  117.     1,Color.new(0,0,0,10),2)
  118.     b = $game_party.actors[@s_index].name.scan(/./)
  119.     b << "Lv"
  120.     b << $game_party.actors[@s_index].level.to_s
  121.     @person[@s_index].bitmap.font.size = 30
  122.     b.each_index {|c| @person[@s_index].bitmap.blur_draw_text(90, 50+30*c, 30, 30,
  123.     b[c],2,Color.new(0,0,0,10),2)}
  124.   end
  125.   def change_s(plus=false)
  126.     if plus
  127.       return if @s_index >= @person.size-1
  128.       @s_index += 1
  129.       for i in 0...10
  130.         @person.each {|a| a.x -= 13}
  131.         Graphics.update
  132.       end
  133.     else
  134.       return if @s_index <= 0
  135.       @s_index -= 1
  136.       for i in 0...10
  137.         @person.each {|a| a.x += 13}
  138.         Graphics.update
  139.       end
  140.     end
  141.   end
  142. end
复制代码

点评

没有经过DEBUG就发上来了= =bbbb  发表于 2011-8-17 12:14

评分

参与人数 2星屑 +132 +1 收起 理由
cc610523 + 1 精品文章
liqunsz + 132 糖果

查看全部评分

某只PHP/HTML小白鼠→退屈の间


Cause I knew you were trouble when you walked in
So shame is on me now
I flow me to place i ve never been
till you put me down oh
Now Im lying on the cold hard ground

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
671
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

2
发表于 2011-8-17 12:28:29 | 只看该作者
嘻,看起来很华丽哟~~沙发归咱啦
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1302
在线时间
673 小时
注册时间
2009-11-11
帖子
2790
3
发表于 2011-8-17 13:01:31 | 只看该作者
感叹啊,各位发的脚本都写得如此规范

点评

哇,2.5D的洛克人?  发表于 2011-9-2 10:27
而且我觉得我不写注释的习惯被鄙视了的样子0.0  发表于 2011-8-17 13:08
昨天刚被主人骂脚本格式不规范的路过。  发表于 2011-8-17 13:04

嘿。嘿。嘿
回复 支持 反对

使用道具 举报

Lv3.寻梦者

酱油的

梦石
0
星屑
1010
在线时间
2161 小时
注册时间
2007-12-22
帖子
3271

贵宾

4
发表于 2011-8-17 13:08:31 | 只看该作者
蛐蛐,你進步了……但是全程Sprite是甚麼回事呀!(翻桌)

点评

我总觉得Window的效率低= =...话说Window内部不也是有好多精灵组成的么= =...  发表于 2011-8-17 13:11
不做頭像做簽名,看我囧冏有神(多謝山人有情提供 )
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1302
在线时间
673 小时
注册时间
2009-11-11
帖子
2790
5
发表于 2011-8-17 13:14:10 | 只看该作者
多写 注释 就是更加人性化啦,至于写不写,多写还是少写,看习惯了,多写就更明白,就这样咯

嘿。嘿。嘿
回复 支持 反对

使用道具 举报

Lv1.梦旅人

弃坑的微博控

梦石
0
星屑
50
在线时间
548 小时
注册时间
2008-6-23
帖子
2114
6
发表于 2011-8-17 14:33:20 | 只看该作者
表示伸手党的福音啊!!  

可是没有注释,我要修改也不知道在哪入手.........

技能、装备、存档什么的快点出来啊喂自己去研究一下,然后把布局修改修改,用脚本描绘就是高级........根本不知道怎么修改。
《灵中那些事》停工很久了。..

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
24 小时
注册时间
2010-9-4
帖子
44
7
发表于 2011-9-2 10:28:26 | 只看该作者
非常精致呢,不过貌似没有存档的说。
喵喵喵~...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
305
在线时间
8 小时
注册时间
2011-11-9
帖子
1
8
发表于 2011-11-14 23:39:43 | 只看该作者
当物品太多时再往下就显示不出来了。。

点评

敢用键盘往下移么||  发表于 2011-11-15 19:06
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-20 17:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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