LiTTleDRAgo Senior
Posts : 712 Thanked : 27 Engine : RMXP Skill : Skilled Type : Scripter
Trophies
Awards: | Subyek: [VX] Minigame Bukan Roulette 2012-05-17, 19:13 | |
| Bukan Roulette Versi: 1 Tipe: Convert-an PengenalanVersi convert-an dari https://rmid.forumotion.net/t6012-minigamebukan-rouletteIseng buat nambah2 post :P Fitur Screenshots Scripts - Code:
-
"Bukan Roulette Version 1.vx Created by Lukas Cahyadi Gunawan Publish : 15/5/2012 Converted to VX by LiTTleDRAgo Publish : 17/5/2012
How To Use ? Place above Main. For RPG VX (RGSS)
Feature: - Play minigame a like a roulette.
Thanks to : - Jesus My Savior
This work is protected by the following license: ---------------------------------------------------------------------------- Creative Commons - Attribusi-NonKomersial 3.0 Unported License. ( http://creativecommons.org/licenses/by-nc/3.0/ ) CC BY-NC (Atribusi-NonKomersial). Memperbolehkan pihak lain untuk menyalin, mengumumkan, menyebarkan, menggubah, danmengadaptasi ciptaan ini, selama mencantumkan nama pembuat. ---------------------------------------------------------------------------- If you find bugs or errors can contact me at http://www.rpgmakerid.com/u2336."
module LCG #=============================================================================# # ▼ CONFIGURATION ▼ #-----------------------------------------------------------------------------# # To call script : $scene = Scene_Roulette.new # Set help text : RHELP1 = 'Input UP/DOWN to Inc/Decrease BET. Input C to SPIN.' RHELP2 = 'SPINNING !!' RHELP3 = 'CONGRATULATIONS !!' RHELP4 = 'You are LOSE !' RSOUND = 'Audio/SE/Spin' # Sfx spin. RLOSE = 'Audio/SE/Attack1' # If you Lose. RWIN = 'Audio/SE/Applause' # If you Win. #-----------------------------------------------------------------------------# # ▲ CONFIGURATION ▲ #=============================================================================# end class Game_Temp attr_accessor :result, :screen end class Window_Help < Window_Base alias drg133_init initialize unless method_defined?(:drg133_init) def initialize return drg133_init if !$scene.is_a?(Scene_Roulette) super(188, 304, 436, 48+10) if $scene.is_a?(Scene_Roulette) end end class Window_Beat < Window_Base def initialize super(188, 352+10, 436, 128-10) @column_max = 2 refresh end def refresh if $game_temp.result.size > 0 if self.contents != nil self.contents.dispose self.contents = nil end self.contents = Bitmap.new(width - 32, height - 32) (0...$game_temp.result.size).each {|i| draw_item(i)} end end def draw_item(index) beat = $game_temp.result.keys[index] x = 4 + index % 2 * 210 y = index / 2 * 24 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.font.color = normal_color self.contents.draw_text(x + 72, y, 16, 24, ':', 1) self.contents.font.color = crisis_color if $game_temp.result[beat] == 'WIN' self.contents.font.color = knockout_color if $game_temp.result[beat] == 'LOSE' self.contents.draw_text(x, y, 182, 24, $game_temp.result[beat].to_s, 2) self.contents.font.color = system_color self.contents.draw_text(x, y, 212, 24, beat.to_s) end end class Window_RltCommand < Window_Selectable def initialize(width, commands) super(32, 400, 124, 64) @item_max = commands.size @column_max = commands.size self.contents = Bitmap.new(@item_max * 110 - 32, height - 32) @commands = commands refresh self.index = 0 end def refresh self.contents.clear (0...@column_max).each {|i| draw_item(i)} end def draw_item(i) self.contents.fill_rect(i*100, 0, 124, 32, Color.new(0, 0, 0, 0)) self.contents.font.color = normal_color self.contents.draw_text(i*100, 0, 96, 32, @commands[i].to_s,1) end def update_cursor() update_cursor_rect end def update_cursor_rect if @index < 0 self.cursor_rect.empty return end column = @index if column < self.top_row self.top_row = column end if column > self.top_row + (self.page_row_max - 1) self.top_row = column - (self.page_row_max - 1) end cursor_width = 100 x = @index * cursor_width - self.ox self.cursor_rect.set(x, 0, 92, 32) end def page_row_max() 1 end def top_row() return self.ox / 100 end def top_row=(column) column = [column,0].max if column > @column_max - 1 column = @commands end self.ox = column * 100 end end class Scene_Roulette include LCG def main $game_temp.screen = [Graphics.width,Graphics.height] $game_temp.result = {} Graphics.resize_screen(640,480) @how = Sprite.new @how.bitmap = Cache.picture('rule') Graphics.transition while !Input.trigger?(Input::C) Graphics.update Input.update end @how.dispose @backro = Sprite.new @backro.bitmap = Cache.picture('backro') @roulette = Sprite.new @roulette.bitmap = Cache.picture('roullate') @roulindex = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36, '2 to 1(a)','2 to 1(b)','2 to 1(c)','1st 12','2nd 12', '3rd 12','1-18','EVEN','RED','BLACK','ODD','19-36'] @command_window = Window_RltCommand.new(124, @roulindex) @data = [19,4,21,2,25,17,34,6,27,13,36,11,30,8,23,10,5, 24,16,33,1,20,14,31,9,22,18,29,7,28,12,35,3,26,0,32,15] @red = [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36] @roulette.x = 121 @roulette.y = 145 @roulette.ox = 96 @roulette.oy = 96 @jarum = Sprite.new @jarum.bitmap = Cache.picture('jarum') @jarum.z = 888 @jarum.x = 170 @jarum.y = 39 @word = Sprite.new @word.bitmap = Bitmap.new(64, 64) @word.bitmap.font.name = "Arial" @word.bitmap.font.size = 64 @word.bitmap.font.color = Color.new(0, 0, 0, 255) @word.z = 889 @word.x = 92 @word.y = 113 @gold_window = Window_Gold.new(0,0) @gold_window.x = 16 @gold_window.y = 320 @beat = Window_Beat.new @help = Window_Help.new @rotate_speed = 0 @update_spin = false @output = nil Graphics.transition while $scene == self Graphics.update Input.update update end @backro.dispose @jarum.dispose @roulette.dispose @word.dispose @command_window.dispose @gold_window.dispose @beat.dispose @help.dispose end def update @help.update @command_window.update if Input.trigger?(Input::B) && @command_window.active $game_temp.result.values.each {|m| $game_party.gain_gold(m)} $game_temp.result.clear Graphics.resize_screen($game_temp.screen[0],$game_temp.screen[1]) $scene = Scene_Map.new elsif Input.trigger?(Input::C) && !@command_window.active && !@update_spin $game_temp.result.clear @beat.refresh @command_window.active = true return end return update_bet if @command_window.active if @update_spin return putar if @rotate_speed > 0 $game_temp.result.keys.each {|i| uang = $game_temp.result[i] return if uang == 'WIN' || uang == 'LOSE' if i == @output o = 1 for l in $game_temp.result.keys o += 1 if @data.include?(l) end $game_party.gain_gold(uang * (36 / o)) $game_temp.result[i] = 'WIN' @gold_window.refresh; @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end if i == '2 to 1(a)' b = [1,4,7,10,13,16,19,22,25,28,31,34] if b.include?(@output) $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh; @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == '2 to 1(b)' c = [2,5,8,11,14,17,20,23,26,29,32,35] if c.include?(@output) $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh; @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == '2 to 1(c)' d = [3,6,9,12,15,18,21,24,27,30,33,36] if d.include?(@output) $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh; @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == '1st 12'; (1..12).each {|a| if @output == a $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh break elsif a == 12 $game_temp.result[i] = 'LOSE' @beat.refresh end} end if i == '2nd 12'; (13..24).each {|a| if @output == a $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh break elsif a == 24 $game_temp.result[i] = 'LOSE' @beat.refresh end} end if i == '3rd 12'; (25..36).each {|a| if @output == a $game_party.gain_gold(uang * 3) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh break elsif a == 36 $game_temp.result[i] = 'LOSE' @beat.refresh end} end if i == '1-18'; (1..18).each {|a| if @output == a $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh; break elsif a == 18 $game_temp.result[i] = 'LOSE' @beat.refresh end} end if i == 'EVEN' if @output % 2 == 0 && @output != 0 $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == 'RED' if @red.include?(@output) $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == 'BLACK' if !@red.include?(@output) && @output != 0 $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == 'ODD'; if @output % 2 > 0 $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh else $game_temp.result[i] = 'LOSE' @beat.refresh end end if i == '19-36'; (19..36).each {|a| if @output == a $game_party.gain_gold(uang * 2) $game_temp.result[i] = 'WIN' @gold_window.refresh @beat.refresh break elsif a == 36 $game_temp.result[i] = 'LOSE' @beat.refresh end} end} if $game_temp.result.values.include?('WIN') #$game_system.se_play($data_system.shop_se) Sound.play_shop @help.set_text(RHELP3 ,1) Audio.se_play(RWIN, 100, 100) rescue nil end if !$game_temp.result.values.include?('WIN') @help.set_text(RHELP4 ,1) Audio.se_play(RLOSE, 100, 100) rescue nil end @update_spin = false @speed_down = 0 end end def update_bet @help.set_text(RHELP1) if Input.repeat?(Input::UP) && $game_party.gold > 4999 && ($game_temp.result.size < 6 || ($game_temp.result.size == 6 && $game_temp.result[@roulindex[@command_window.index]] != nil)) if !@data.include?(@roulindex[@command_window.index]) return if @rotate_speed < 0 && !$game_temp.result.include?(@roulindex[@command_window.index]) @rotate_speed = -1 end #Audio.se_play('Audio/SE/002-System02', 80, 100) rescue nil Sound.play_decision $game_party.gain_gold(-5000) s = $game_temp.result[@roulindex[@command_window.index]] duit = (s ? s : 0) + 5000 $game_temp.result[@roulindex[@command_window.index]] = duit @gold_window.refresh @beat.refresh elsif Input.repeat?(Input::DOWN) && $game_temp.result[@roulindex[@command_window.index]] != nil && $game_temp.result[@roulindex[@command_window.index]] > 4999 #Audio.se_play('Audio/SE/003-System03', 80, 100) rescue nil Sound.play_cancel duit = $game_temp.result[@roulindex[@command_window.index]] - 5000 $game_temp.result[@roulindex[@command_window.index]] = duit @rotate_speed = 0 if !@data.include?(@roulindex[@command_window.index]) && duit == 0 $game_temp.result.delete(@roulindex[@command_window.index]) if duit == 0 $game_party.gain_gold(5000) @gold_window.refresh @beat.refresh elsif Input.trigger?(Input::C) && $game_temp.result.size > 0 @help.set_text(RHELP2,1); @speed_down = 0 @command_window.active = false @rotate_speed = 70 + rand(21) @update_spin = true Audio.se_play(RSOUND, 100, 100) rescue nil return end end def putar @speed_down += 1 if @speed_down < 77 @rotate_speed -= 1 if @speed_down > 76 @roulette.angle += @rotate_speed / 2.0 while @roulette.angle < 0 do @roulette.angle += 360 end @roulette.angle %= 360 @output = @data[(@roulette.angle / 9.72).to_i + 1] @word.bitmap.clear @word.bitmap.draw_text(0, 0, 64, 64, @output.to_s,1) end end Graphic + Suara spinnya ambil aja dari demonya kk lukas Credits | |
|