赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1560 |
最后登录 | 2013-11-12 |
在线时间 | 21 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 21 小时
- 注册时间
- 2010-8-22
- 帖子
- 28
|
- ##==============================================================================
- # ★【接 金 币】★ <VX>
- #==============================================================================
- # by -> 芯☆淡如水
- #==============================================================================
- # ● 使用方法:复制该脚本,插入到 main 前。
- # 进入 接金币 场景,请在事件 -> 脚本 里写入:$scene = Take_Gold.new
- #==============================================================================
- #==============================================================================
- #============================================================================
- # 设置:
- #============================================================================
- # 输出该场游戏所得分数,代入下面设置的变量(ID)
- VAR_ID = 1
- #------------------------------------------------
- # 每得到 ?分增加一次速度?
- LEVEL_MARK = 500
- #------------------------------------------------
- # 游戏 BGM
- GAME_BGM_NAME = "Scene7"
- #------------------------------------------------
- # 角色受伤 SE (刀)
- BI_SE_NAME1 = "Slash1"
- #------------------------------------------------
- # 角色受伤 SE (炸弹)
- BI_SE_NAME2 = "Earth3"
- #------------------------------------------------
- # 加分 SE
- GOLD_SE_NAME = "Shop"
- #------------------------------------------------
- # 减分 SE
- LG_SE_NAME = "Fog1"
- #------------------------------------------------
- # 回复 SE
- RV_SE_NAME = "Item1"
- #============================================================================
- module Goods # 刀 炸弹 小金币 大金币 钱袋 钻石 加血 恶魔
- GOODS_TYPE = [0, 1, 2, 3, 4, 5, 6, 7]
-
- GOODS_ICON_NAMES = ["刀", "炸弹","金币1", "金币2", "钱袋", "钻石", "加血", "恶魔"]
-
- GOODS_MOVE_SPEED = [3, 4, 3, 4, 4, 5, 6, 4]
- end
- #============================================================================
- class Game_Good
- attr_accessor :type
- attr_accessor :x
- attr_accessor :y
- attr_accessor :icon_name
- attr_accessor :move_speed
- attr_accessor :count
- #-----------------------------------------------------------------------
- def initialize(type)
- @type = type
- @x = rand 266
- @y = 0
- @icon_name = Goods::GOODS_ICON_NAMES[type]
- @move_speed = Goods::GOODS_MOVE_SPEED[type]
- @count = 0
- end
- #-----------------------------------------------------------------------
- end
- #============================================================================
- class Window_Player < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.members[0]
- @bitmap = Cache.character(@actor.character_name)
- sign = @actor.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- @cw = @bitmap.width / 3
- @ch = @bitmap.height / 4
- else
- @cw = @bitmap.width / 12
- @ch = @bitmap.height / 8
- end
- width = @cw + 32
- height = @ch + 32
- super(356, 415 - height, width, height)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- self.z = 999
- set_player(0, 0)
- end
- #--------------------------------------------------------------------------
- def set_player(direction, count)
- self.contents.clear
- index = @actor.character_index
- sx = (index % 4 * 3 + count) * @cw
- sy = (index / 4 * 4 + direction + 1) * @ch
- src_rect = Rect.new(sx, sy, @cw, @ch)
- self.contents.blt(0, 0, @bitmap, src_rect)
- end
- end
- #=============================================================================
- class Window_Title < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 260, 164)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- self.z = 999
- end
- #--------------------------------------------------------------------------
- def set_start(a)
- self.contents.clear
- self.contents.font.color = Color.new(255, 120, 255, a)
- self.contents.font.size = 46
- self.contents.draw_text(34, 0, 220, 64, "接 金 币")
- self.contents.draw_text(54, 64, 220, 64, "Start!")
- self.visible = true
- end
- #--------------------------------------------------------------------------
- def set_end
- self.contents.clear
- self.contents.font.size = 46
- self.contents.font.color = text_color(2)
- self.contents.draw_text(14, 30, 220, 64, "游戏结束")
- self.contents.font.size = 26
- self.contents.font.color = text_color(5)
- self.contents.draw_text(34, 76, 68, 64, "得分:")
- self.contents.font.color = text_color(6)
- self.contents.draw_text(106, 76, 196, 64, $take_gold.to_s)
- self.visible = true
- end
- end
- #==============================================================================
- class Window_Goods < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(220, 0, 322, 415)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- def set_goods(goods)
- self.contents.clear
- return if goods == []
- for good in goods
- bitmap = Cache.picture(good.icon_name)
- x = good.x
- y = good.y
- self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24))
- end
- end
- end
- #=============================================================================
- class Window_Message_Show < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 252, 186)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- def set_txt(hp, gold)
- self.contents.clear
- bitmap = Cache.picture("hp")
- width = bitmap.width * hp / 100
- rect = Rect.new(0, 0, width, bitmap.height)
- self.contents.blt(67, 56, bitmap, rect)
- cx = contents.text_size(gold.to_s).width
- self.contents.font.color = text_color(6)
- self.contents.font.size = 32
- self.contents.draw_text(100, 94, cx, 32, gold.to_s)
- end
- end
- #==============================================================================
- class Window_Top < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.visible = false
- self.opacity = 0
- self.z = 9999
- end
- #--------------------------------------------------------------------------
- def set_txt(type, txt)
- self.contents.clear
- case type
- when 0
- text = "H P:"
- when 1
- text = "Gold:"
- end
- self.contents.font.size = 20
- self.contents.font.color = Color.new(255, 255, 128, 255)
- self.contents.draw_text(0, 0, 64, 32, text)
- self.contents.font.color = Color.new(255, 128, 255, 255)
- self.contents.draw_text(54, 0, 96, 32, txt)
- self.visible = true
- end
- end
- #==============================================================================
- #==============================================================================
- class Take_Gold
- #--------------------------------------------------------------------------
- def main
- @menu_com = Sprite.new
- @menu_com.bitmap = Cache.picture("背景.png")
- @command_window = Window_Command.new(160, ["结束游戏", "返回"])
- @command_window.x = 300
- @command_window.y = 200
- @command_window.z = 999
- @command_window.opacity = 0
- @command_window.active = false
- @command_window.visible = false
- @player_window = Window_Player.new
- @goods_window = Window_Goods.new
- @ms_window = Window_Message_Show.new
- [url=home.php?mod=space&uid=35023]@top[/url] = Window_Top.new
- @tit_window = Window_Title.new
- @game_hp = 100
- @direction = 0
- @move_count = 0
- @move_speed = 4
- @count = 0
- @goods = []
- @top_mess = []
- $take_gold = 0
- @game_end = false
- Audio.bgm_play("Audio/BGM/" + GAME_BGM_NAME, 100, 100)
- Graphics.transition(40, "Graphics/System/BattleStart")
- loop do
- Graphics.update
- update_start
- if @count >= 130
- break
- end
- end
- @count = 0
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- RPG::BGM.stop
- Graphics.transition
- Graphics.freeze
- @menu_com.dispose
- @player_window.dispose
- @goods_window.dispose
- @ms_window.dispose
- @top.dispose
- @tit_window.dispose
- @command_window.dispose
- end
- #--------------------------------------------------------------------------
- def update_start
- @count += 1
- @tit_window.x = 260
- @tit_window.y = 80
- a = 255 - @count * 2
- @tit_window.set_start(a)
- @tit_window.visible = false if @count >= 130
- end
- #--------------------------------------------------------------------------
- def update
- @command_window.update
- @ms_window.set_txt(@game_hp, $take_gold)
- if @game_end
- game_end
- return
- end
- if @command_window.active
- update_command
- return
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @command_window.visible = true
- return
- end
- take_gold
- end
- #---------------------------------------------------------------------------
- def update_command
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = false
- @command_window.visible = false
- return
- end
- if Input.trigger?(Input::C)
- case @command_window.index
- when 0
- Sound.play_decision
- @command_window.active = false
- @command_window.visible = false
- @count = 0
- @game_end = true
- when 1
- Sound.play_cancel
- @command_window.active = false
- @command_window.visible = false
- end
- end
- end
- #---------------------------------------------------------------------------
- def take_gold
- include_goods
- @count += 1
- case Input.dir4
- when 4
- @direction = 0
- @move_count += 1
- @player_window.x -= @move_speed if @player_window.x > @goods_window.x
- when 6
- @direction = 1
- @move_count += 1
- if @player_window.x < @goods_window.x + @goods_window.width - @player_window.width
- @player_window.x += @move_speed
- end
- end
- @player_window.set_player(@direction, @move_count % 30 / 10)
- for good in @goods
- next if good == nil
- if touch_jude(good.x, good.y)
- @goods.delete(good)
- good_effect(good.type)
- next
- end
- good.count += 1
- move_speed = good.move_speed + $take_gold / LEVEL_MARK
- good.y = good.count * move_speed
- if good.y > 400
- @goods.delete(good)
- next
- end
- end
- @goods_window.set_goods(@goods)
- if @top_mess != []
- @top.x = [@player_window.x - 10, 550 - @top.width].min
- @top.y = @player_window.y
- @top.set_txt(@top_mess[0], @top_mess[1])
- @top_mess = []
- end
- if @top.visible
- @top.visible = false if @top.y <= @player_window.y - 50
- @top.y -= 1 if @count % 2 == 0
- end
- end
- #---------------------------------------------------------------------------
- def include_goods
- v = [10 - $take_gold / LEVEL_MARK, 1].max
- if @count % v == 0
- case rand 100
- when 0..3
- for i in 1..4
- @goods.push(Game_Good.new(make_type))
- end
- when 4..10
- for i in 1..3
- @goods.push(Game_Good.new(make_type))
- end
- when 11..20
- for i in 1..2
- @goods.push(Game_Good.new(make_type))
- end
- when 21..55
- @goods.push(Game_Good.new(make_type))
- end
- end
- end
- #---------------------------------------------------------------------------
- def make_type
- case rand 100
- when 0..1
- type = 6
- when 2..5
- type = 5
- when 6..12
- type = 4
- when 13..25
- type = 3
- when 26..30
- type = 2
- when 30..55
- type = 1
- when 56..70
- type = 7
- else
- type = 0
- end
- return type
- end
- #---------------------------------------------------------------------------
- def good_effect(type)
- @top_mess = []
- case type
- when 0
- Audio.se_play("Audio/SE/" + BI_SE_NAME1, 80, 100)
- @game_hp -= 10
- @top_mess.push(0, "-10")
- when 1
- Audio.se_play("Audio/SE/" + BI_SE_NAME2, 80, 100)
- @game_hp -= 30
- @top_mess.push(0, "-30")
- when 2
- Audio.se_play("Audio/SE/" + GOLD_SE_NAME, 80, 100)
- $take_gold += 5
- @top_mess.push(1, "+5")
- when 3
- Audio.se_play("Audio/SE/" + GOLD_SE_NAME, 80, 100)
- $take_gold += 10
- @top_mess.push(1, "+10")
- when 4
- Audio.se_play("Audio/SE/" + GOLD_SE_NAME, 80, 100)
- $take_gold += 50
- @top_mess.push(1, "+50")
- when 5
- Audio.se_play("Audio/SE/" + GOLD_SE_NAME, 80, 100)
- $take_gold += 100
- @top_mess.push(1, "+100")
- when 6
- Audio.se_play("Audio/SE/" + RV_SE_NAME, 80, 100)
- txt = "+" + (100 - @game_hp).to_s
- @game_hp = 100
- @top_mess.push(0, txt)
- when 7
- Audio.se_play("Audio/SE/" + BI_SE_NAME2, 80, 100)
- @game_hp -= 10
- Audio.se_play("Audio/SE/" + LG_SE_NAME, 80, 100)
- $take_gold -= 100
- @top_mess.push(1, "-100")
- end
- @game_hp = [[@game_hp, 100].min, 0].max
- @count = 0 if @game_hp <= 0
- @game_end = true if @game_hp <= 0
- $take_gold = [$take_gold, 0].max
- @ms_window.set_txt(@game_hp, $take_gold)
- end
- #---------------------------------------------------------------------------
- def touch_jude(x, y)
- wx = @player_window.x - @goods_window.x - 16
- wy = @player_window.y
- xmin = wx + 16
- xmax = wx + @player_window.width - 16
- if wy + 16 > y + 24
- return false
- end
- if x + 12 < xmin or x + 12 > xmax
- return false
- end
- return true
- end
- #---------------------------------------------------------------------------
- def game_end
- @count += 1
- @tit_window.set_end
- if Input.trigger?(Input::C) and @count > 80 or @count > 180
- Sound.play_decision
- $game_variables[VAR_ID] = $take_gold
- $scene = Scene_Map.new
- end
- end
- end
- #==============================================================================
复制代码 |
|