赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2690 |
最后登录 | 2015-4-29 |
在线时间 | 58 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 58 小时
- 注册时间
- 2007-8-10
- 帖子
- 284
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
http://rpg.blue/web/htm/news846.htm
这个是读取金钱
可不可以做到读取变量呢 怎莫做到呢
求解 谢谢 了
脚本在这里
- class Frute
- def main
- Audio.bgm_play("Audio/BGM/017-Theme06.mid",70,100)
- @back = Sprite.new
- @back.bitmap = Bitmap.new('Graphics/Pictures/back')
- @light = Sprite.new
- @light.bitmap = Bitmap.new('Graphics/Pictures/light')
- @light.x = 276 ; @light.y = 89
- @button = []
-
- @button[0] = Sprite.new
- @button[0].bitmap = Bitmap.new('Graphics/Pictures/苹果')
- @button[0].x = 451 ; @button[0].y = 210
- @button[0].visible = false
-
- @button[1] = Sprite.new
- @button[1].bitmap = Bitmap.new('Graphics/Pictures/西瓜')
- @button[1].x = 487 ; @button[1].y = 210
- @button[1].visible = false
-
- @button[2] = Sprite.new
- @button[2].bitmap = Bitmap.new('Graphics/Pictures/双星')
- @button[2].x = 523 ; @button[2].y = 210
- @button[2].visible = false
-
- @button[3] = Sprite.new
- @button[3].bitmap = Bitmap.new('Graphics/Pictures/双7')
- @button[3].x = 559 ; @button[3].y = 210
- @button[3].visible = false
-
- @button[4] = Sprite.new
- @button[4].bitmap = Bitmap.new('Graphics/Pictures/Bar')
- @button[4].x = 595 ; @button[4].y = 210
- @button[4].visible = false
-
- @button[5] = Sprite.new
- @button[5].bitmap = Bitmap.new('Graphics/Pictures/铃铛')
- @button[5].x = 469 ; @button[5].y = 311
- @button[5].visible = false
-
- @button[6] = Sprite.new
- @button[6].bitmap = Bitmap.new('Graphics/Pictures/木瓜')
- @button[6].x = 505 ; @button[6].y = 311
- @button[6].visible = false
-
- @button[7] = Sprite.new
- @button[7].bitmap = Bitmap.new('Graphics/Pictures/橘子')
- @button[7].x = 541 ; @button[7].y = 311
- @button[7].visible = false
-
- @button[8] = Sprite.new
- @button[8].bitmap = Bitmap.new('Graphics/Pictures/樱桃')
- @button[8].x = 577 ; @button[8].y = 311
- @button[8].visible = false
-
- $下注 = [0,0,0,0,0,0,0,0,0]
- @位置 = [[276,89],[335,89],[360,89],[360,114],[360,173],[360,232],[360,291],[360,350],[360,375],
- [335,375],[276,375],[217,375],[158,375],[99,375],[74,375],[74,350],[74,291],[74,232],
- [74,173],[74,114],[74,89],[99,89],[158,89],[217,89]]
-
- @水果 = [1,9,7,2,9,0,1,9,8,6,9,4,1,9,7,3,9,0,1,9,8,6,5,10]
- $分数 = 0
-
- @目前位置 = 0
- @停止延迟 = 0
- @转动中 = false
- @结果计算 = false
- @猜大小 = false
- @bonus = Window_Bonus.new
- @smbg = Window_Smbg.new
- @smbg.visible = false
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入情报
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放活动块
- @smbg.dispose if [email protected]?
- @bonus.dispose
- @back.dispose
- @light.dispose
- for i in 0..8
- @button[i].dispose
- end
- end
-
-
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- mouse_x, mouse_y = Mouse.get_mouse_pos
- # if Input.trigger?(Input::C)
- # p mouse_x, mouse_y
- # end
- if @转动中
- if @停止延迟 > 50
- @停止延迟 -= 1
- @目前位置 += 1
- @目前位置 = 0 if @目前位置 == @位置.size
- @light.x = @位置[@目前位置][0] ; @light.y = @位置[@目前位置][1]
- elsif @停止延迟 > 0
- @停止延迟 -= 1
- if @停止延迟 % 3 == 0
- @目前位置 += 1
- @目前位置 = 0 if @目前位置 == @位置.size
- @light.x = @位置[@目前位置][0] ; @light.y = @位置[@目前位置][1]
- end
- if @停止延迟 == 0
- @转动中 = false
- @结果计算 = true
- return
- end
- end
- end
- if mouse_x > 451 and mouse_y > 210 and mouse_x < 481 and mouse_y < 234
- @button[0].visible = true
- else
- @button[0].visible = false
- end
- if mouse_x > 487 and mouse_y > 210 and mouse_x < 517 and mouse_y < 234
- @button[1].visible = true
- else
- @button[1].visible = false
- end
- if mouse_x > 523 and mouse_y > 210 and mouse_x < 553 and mouse_y < 234
- @button[2].visible = true
- else
- @button[2].visible = false
- end
- if mouse_x > 559 and mouse_y > 210 and mouse_x < 589 and mouse_y < 234
- @button[3].visible = true
- else
- @button[3].visible = false
- end
- if mouse_x > 595 and mouse_y > 210 and mouse_x < 625 and mouse_y < 234
- @button[4].visible = true
- else
- @button[4].visible = false
- end
- if mouse_x > 469 and mouse_y > 311 and mouse_x < 499 and mouse_y < 335
- @button[5].visible = true
- else
- @button[5].visible = false
- end
- if mouse_x > 505 and mouse_y > 311 and mouse_x < 535 and mouse_y < 335
- @button[6].visible = true
- else
- @button[6].visible = false
- end
-
- if mouse_x > 541 and mouse_y > 311 and mouse_x < 571 and mouse_y < 335
- @button[7].visible = true
- else
- @button[7].visible = false
- end
- if mouse_x > 577 and mouse_y > 311 and mouse_x < 607 and mouse_y < 335
- @button[8].visible = true
- else
- @button[8].visible = false
- end
-
-
- if Mouse.press?(Mouse::LEFT)
- return if @停止延迟 != 0 and @转动中
- if !@猜大小
- @猜大小 = false ; @smbg.visible = false
- if $分数 != 0
- $game_party.gain_gold($分数)
- $分数 = 0
- @bonus.refresh
- end
-
- if mouse_x > 490 and mouse_y > 386 and mouse_x < 583 and mouse_y < 407
- h = 0
- for i in $下注
- h += i
- end
- if h == 0
- if @记忆.nil?
- return
- else
- j = 0
- for i in @记忆
- j += i
- end
- return if j > $game_party.gold
- $下注 = @记忆.clone
- $game_party.lose_gold(j)
- @bonus.refresh
- end
- end
- @转动中 = true
- @停止延迟 = rand(50) + 100
- end
-
- for i in [email protected]
- if @button[i].visible
- return if $下注[i] == 99 or $game_party.gold == 0
- $下注[i] += 1
- $game_party.lose_gold(1)
- @bonus.refresh
- break
- end
- end
- else
- if mouse_x > 460 and mouse_y > 420 and mouse_x < 523 and mouse_y < 450
- @猜大小 = false
- if $r < 5
- $分数 *= 2
- Audio.se_play("Audio/SE/056-Right02.ogg",100,100)
- else
- $分数 = 0
- Audio.se_play("Audio/SE/058-Wrong02.ogg",100,100)
- end
- for i in 1..10
- Graphics.update
- end
- @bonus.refresh
- @猜大小 = true if $分数 != 0
- @smbg.visible = false if $分数 == 0
- elsif mouse_x > 550 and mouse_y > 420 and mouse_x < 613 and mouse_y < 450
- @猜大小 = false
- if $r > 4
- $分数 *= 2
- Audio.se_play("Audio/SE/056-Right02.ogg",100,100)
- else
- $分数 = 0
- Audio.se_play("Audio/SE/058-Wrong02.ogg",100,100)
- end
- for i in 1..20
- Graphics.update
- end
- @bonus.refresh
- @猜大小 = true if $分数 != 0
- @smbg.visible = false if $分数 == 0
- else
- @猜大小 = false ; @smbg.visible = false
- if $分数 != 0
- $game_party.gain_gold($分数)
- $分数 = 0
- @bonus.refresh
- end
-
- end
- end
- end
-
- if Mouse.press?(Mouse::RIGHT)
- return if @停止延迟 != 0 and @转动中
- k = false
- for i in [email protected]
- if @button[i].visible
- k = true
- return if $下注[i] == 0
- $下注[i] -= 1
- $game_party.gain_gold(1)
- @bonus.refresh
- break
- end
- end
- if k == false
- h = 0
- for i in $下注
- h += i
- end
- $game_party.gain_gold(h) if h != 0
- $game_party.gain_gold($分数) if $分数 != 0
- Audio.bgm_stop
- $scene = Scene_Map.new
- end
- end
-
- if @结果计算
- case @水果[@目前位置]
- when 1
- $分数 = $下注[0] * 5
- when 2
- $分数 = $下注[1] * 20
- when 3
- $分数 = $下注[2] * 30
- when 4
- $分数 = $下注[3] * 40
- when 5
- $分数 = $下注[4] * 50
- when 6
- $分数 = $下注[5] * 20
- when 7
- $分数 = $下注[6] * 15
- when 8
- $分数 = $下注[7] * 10
- when 9
- $分数 = $下注[8] * 2
- when 10
- $分数 = $下注[4] * 100
- when 0
- $分数 = 0
- Audio.se_play("Audio/SE/061-Thunderclap01.ogg",100,100)
- end
- if $下注 == [0,0,0,0,0,0,0,0,0]
- @记忆 = nil
- else
- @记忆 = $下注.clone
- end
- $下注 = [0,0,0,0,0,0,0,0,0]
- @bonus.refresh
- @结果计算 = false
- if $分数 != 0
- @猜大小 = true
- Audio.se_play("Audio/SE/006-System06.ogg",100,100)
- end
- end
- if @猜大小
- @smbg.visible = true
- @smbg.refresh
- end
- if Input.trigger?(Input::A)
- p mouse_x, mouse_y
- end
- end
-
-
- end
- #==============================================================================
- # ■ Window_Gold
- #------------------------------------------------------------------------------
- # 显示金钱的窗口。
- #==============================================================================
- class Window_Bonus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(440, 40, 200, 340)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- cx = contents.text_size($data_system.words.gold).width
- self.contents.font.color = normal_color
- self.contents.draw_text(12, 8, 120-cx-2, 32, $game_party.gold.to_s, 2)
- self.contents.draw_text(12, 44, 120-cx-2, 32, $分数.to_s, 2)
- self.contents.draw_text(-4, 177, 32, 32, $下注[0].to_s, 1)
- self.contents.draw_text(32, 177, 32, 32, $下注[1].to_s, 1)
- self.contents.draw_text(68, 177, 32, 32, $下注[2].to_s, 1)
- self.contents.draw_text(104, 177, 32, 32, $下注[3].to_s, 1)
- self.contents.draw_text(140, 177, 32, 32, $下注[4].to_s, 1)
- self.contents.draw_text(14, 278, 32, 32, $下注[5].to_s, 1)
- self.contents.draw_text(50, 278, 32, 32, $下注[6].to_s, 1)
- self.contents.draw_text(86, 278, 32, 32, $下注[7].to_s, 1)
- self.contents.draw_text(122, 278, 32, 32, $下注[8].to_s, 1)
-
-
- end
- end
- class Window_Smbg < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(195, 300, 64, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- $r = rand(10)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, 32, 32, $r.to_s,1)
- end
- end
复制代码
版务信息:本贴由楼主自主结贴~ |
|