Implementasi Ruby Game Scripting System Pada Game Ludo

xxxiv

Option Scene

SceneManager.call(MyOpt)

class MyOpt < Scene_MenuBase
def start
super
create_kubu_window
create_opt_window
create_deskripsi_window
end

def create_kubu_window
@KubuWindow = MyKubuWindow.new
end

def create_deskripsi_window
@desk_window = DeskripsiWindow.new
end


def create_opt_window
@opt_window = MyOptWindow.new
@opt_window.set_handler(:merah, method(:pilih1))
@opt_window.set_handler(:kuning, method(:pilih2))
@opt_window.set_handler(:hijau, method(:pilih3))
@opt_window.set_handler(:biru, method(:pilih4))
@opt_window.set_handler(:cancel, method(:pilih5))
end

Universitas Sumatera Utara

xxxv

def pilih1
$game_switches[81] = true
create_strategi_window
end
def pilih2
$game_switches[82] = true

create_strategi_window
end
def pilih3
$game_switches[83] = true
create_strategi_window
end
def pilih4
$game_switches[84] = true
create_strategi_window
end
def pilih5
create_mulai_window
end

def create_mulai_window
@mulai_window = MulaiWindow.new
@mulai_window.set_handler(:mulai,

method(:bermain))


@mulai_window.set_handler(:kembali, method(:batal))
end
def create_strategi_window
@strag_window = StragWindow.new
@strag_window.set_handler(:komp1, method(:strag1))
@strag_window.set_handler(:komp2, method(:strag2))
@strag_window.set_handler(:komp3, method(:strag3))
@strag_window.set_handler(:komp4, method(:strag4))
@strag_window.set_handler(:komp5, method(:strag5))
@strag_window.set_handler(:komp6, method(:strag6))

Universitas Sumatera Utara

xxxvi

@strag_window.set_handler(:cancel,

method(:balik))

end


def bermain
return_scene
$game_temp.fade_type = 0
$game_player.reserve_transfer(1, 8, 8, 0)
end

def batal
@mulai_window.close
@opt_window.activate
end

def balik
$game_switches[81] = false
$game_switches[82] = false
$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@opt_window.activate
end


def strag1
if $game_switches[81] == true
$line1 = "Komp 1"
$desk1 = "Go Out > Hit > Finish"
$game_variables[81] = 0
end
if $game_switches[82] == true
$line2 = "Komp 1"
$desk2 = "Go Out > Hit > Finish"
$game_variables[82] = 0

Universitas Sumatera Utara

xxxvii

end
if $game_switches[83] == true
$line3 = "Komp 1"
$desk3 = "Go Out > Hit > Finish"

$game_variables[83] = 0
end
if $game_switches[84] == true
$line4 = "Komp 1"
$desk4 = "Go Out > Hit > Finish"
$game_variables[84] = 0
end

$game_switches[81] = false
$game_switches[82] = false
$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
def strag2
if $game_switches[81] == true
$line1 = "Komp 2"

$desk1 = "Go Out > Finish > Hit"
$game_variables[81] = 1
end
if $game_switches[82] == true
$line2 = "Komp 2"
$desk2 = "Go Out > Finish > Hit"
$game_variables[82] = 1
end

Universitas Sumatera Utara

xxxviii

if $game_switches[83] == true
$line3 = "Komp 2"
$desk3 = "Go Out > Finish > Hit"
$game_variables[83] = 1
end
if $game_switches[84] == true
$line4 = "Komp 2"

$desk4 = "Go Out > Finish > Hit"
$game_variables[84] = 1
end
$game_switches[81] = false
$game_switches[82] = false
$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
def strag3
if $game_switches[81] == true
$line1 = "Komp 3"
$desk1 = "Hit > Go Out > Finish"
$game_variables[81] = 2
end
if $game_switches[82] == true
$line2 = "Komp 3"

$desk2 = "Hit > Go Out > Finish"
$game_variables[82] = 2
end
if $game_switches[83] == true
$line3 = "Komp 3"
$desk3 = "Hit > Go Out > Finish"

Universitas Sumatera Utara

xxxix

$game_variables[83] = 2
end
if $game_switches[84] == true
$line4 = "Komp 3"
$desk4 = "Hit > Go Out > Finish"
$game_variables[84] = 2
end
$game_switches[81] = false
$game_switches[82] = false

$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
def strag4
if $game_switches[81] == true
$line1 = "Komp 4"
$desk1 = "Hit > Finish > Go Out"
$game_variables[81] = 3
end
if $game_switches[82] == true
$line2 = "Komp 4"
$desk2 = "Hit > Finish > Go Out"
$game_variables[82] = 3
end
if $game_switches[83] == true
$line3 = "Komp 4"

$desk3 = "Hit > Finish > Go Out"
$game_variables[83] = 3
end
if $game_switches[84] == true

Universitas Sumatera Utara

xl

$line4 = "Komp 4"
$desk4 = "Hit > Finish > Go Out"
$game_variables[84] = 3
end
$game_switches[81] = false
$game_switches[82] = false
$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
def strag5
if $game_switches[81] == true
$line1 = "Komp 5"
$desk1 = "Finish > Go Out > Hit"
$game_variables[81] = 4
end
if $game_switches[82] == true
$line2 = "Komp 5"
$desk2 = "Finish > Go Out > Hit"
$game_variables[82] = 4
end
if $game_switches[83] == true
$line3 = "Komp 5"
$desk3 = "Finish > Go Out > Hit"
$game_variables[83] = 4
end
if $game_switches[84] == true
$line4 = "Komp 5"
$desk4 = "Finish > Go Out > Hit"
$game_variables[84] = 4

Universitas Sumatera Utara

xli

end
$game_switches[81] = false
$game_switches[82] = false
$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
def strag6
if $game_switches[81] == true
$line1 = "Komp 6"
$desk1 = "Finish > Hit > Go Out"
$game_variables[81] = 5
end
if $game_switches[82] == true
$line2 = "Komp 6"
$desk2 = "Finish > Hit > Go Out"
$game_variables[82] = 5
end
if $game_switches[83] == true
$line3 = "Komp 6"
$desk3 = "Finish > Hit > Go Out"
$game_variables[83] = 5
end
if $game_switches[84] == true
$line4 = "Komp 6"
$desk4 = "Finish > Hit > Go Out"
$game_variables[84] = 5
end
$game_switches[81] = false
$game_switches[82] = false

Universitas Sumatera Utara

xlii

$game_switches[83] = false
$game_switches[84] = false
@strag_window.close
@desk_window.refresh
@opt_window.refresh
@opt_window.activate
end
end

class MyKubuWindow < Window_Base
def initialize
super(Graphics.width/2 - 230, Graphics.height/2 - 64, 100, 128)
refresh
end

def refresh
change_color(merah_color)
draw_text(0,0,100,24,"Merah")
change_color(kuning_color)
draw_text(0,24,100,24,"Kuning")
change_color(hijau_color)
draw_text(0,48,100,24,"Hijau")
change_color(biru_color)
draw_text(0,72,100,24,"Biru")
end
end

class DeskripsiWindow < Window_Base
def initialize
$desk1
$desk2
$desk3

Universitas Sumatera Utara

xliii

$desk4
super(Graphics.width/2 - 30, Graphics.height/2 - 64, 260, 128)
refresh
end

def refresh
contents.clear
draw_text_ex(0,0,$desk1 || "Go Out > Hit > Finish")
draw_text_ex(0,24,$desk2 || "Go Out > Hit > Finish")
draw_text_ex(0,48,$desk3 || "Go Out > Hit > Finish")
draw_text_ex(0,72,$desk4 || "Go Out > Hit > Finish")
end
end

class MulaiWindow < Window_Command
def initialize
super(Graphics.width/2 - 130, Graphics.height/2 + 64)
end

def visible_line_number
return 1
end

def col_max
return 2
end

def window_width
return 200
end
def window_height
return 48
end

Universitas Sumatera Utara

xliv

def make_command_list
mulai
end

def mulai
add_command("Mulai", :mulai)
add_command("Batal", :kembali)
end

end

class MyOptWindow < Window_Command
def initialize
$line1
$line2
$line3
$line4
super(Graphics.width/2 - 130,Graphics.height/2 - 64)
end

def make_command_list
main
end

def window_width
return 100
end

def window_height
return 128
end
def main

Universitas Sumatera Utara

xlv

add_command($line1 || "Komp 1", :merah)
add_command($line2 || "Komp 1", :kuning)
add_command($line3 || "Komp 1", :hijau)
add_command($line4 || "Komp 1", :biru)
end
end

class StragWindow < Window_Command
def initialize
super(Graphics.width/2 - 130,Graphics.height/2 + 64)
end

def visible_line_number
return 3
end

def col_max
return 2
end

def make_command_list
main
end

def window_width
return 200
end

def window_height
return 96
end

def main

Universitas Sumatera Utara

xlvi

add_command("Komp 1", :komp1)
add_command("Komp 2", :komp2)
add_command("Komp 3", :komp3)
add_command("Komp 4", :komp4)
add_command("Komp 5", :komp5)
add_command("Komp 6", :komp6)
end
end

Mulai

@win = Window_Base.new(5,5,150,50)
@text = "\\c[10]Merah Main"
@win.draw_text_ex(0,0,@text)
wait(100)
@win.dispose
$game_switches[1] = true
$game_self_switches[[1, @event_id, 'A']] = true
wait(5)

Roll dadu

$game_variables[18] = rand(6)+1
$game_variables[1] = $game_variables [18]
$game_temp.reserve_common_event(1)
wait(60)
$game_switches[2] = true
$game_switches[1] = false
wait(5)
gelap = Tone.new(-160,-160,-160,60)
$game_map.screen.start_tone_change(gelap, 60)
screen.pictures[1].show("1", 0, -100, 190, 100, 100, 255, 0)

Universitas Sumatera Utara

xlvii

screen.pictures[1].move(0, 220, 190, 100, 100, 255, 0, 30)
wait(60)
RPG::SE.new("KocokDadu", 100, 120).play
wait(20)

while $game_variables[19] != 200
$game_variables[20]= rand(6)+1
if $game_variables[20] == 1
screen.pictures[1].show("1", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[20] == 2
screen.pictures[1].show("2", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[20] == 3
screen.pictures[1].show("3", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[20] == 4
screen.pictures[1].show("4", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[20] == 5
screen.pictures[1].show("5", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[20] == 6
screen.pictures[1].show("6", 0, 220, 190, 100, 100, 255, 0)
end
wait(2)
$game_variables[19] += 2
end

if $game_variables[18] == 1
screen.pictures[1].show("1", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[18] == 2

Universitas Sumatera Utara

xlviii

screen.pictures[1].show("2", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[18] == 3
screen.pictures[1].show("3", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[18] == 4
screen.pictures[1].show("4", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[18] == 5
screen.pictures[1].show("5", 0, 220, 190, 100, 100, 255, 0)
end
if $game_variables[18] == 6
screen.pictures[1].show("6", 0, 220, 190, 100, 100, 255, 0)
end
RPG::SE.new("Decision1", 100, 120).play
$game_variables[19] = 0
cerah = Tone.new(0, 0, 0, 0)
$game_map.screen.start_tone_change(cerah, 60)
wait(60)
screen.pictures[1].move(0, 550, 190, 100, 100, 255, 0, 30)

Universitas Sumatera Utara

xlix

Quick Finish

Universitas Sumatera Utara

l

Universitas Sumatera Utara

li

Hit First

Universitas Sumatera Utara

lii

Universitas Sumatera Utara

liii

Go Out First

Universitas Sumatera Utara

liv

Universitas Sumatera Utara