Code:
#==============================================================================
# Ocarina script
# by RENEGADEOFBMX ( formely nahchito)
# 20/12/2007
#==============================================================================
class Game_System
attr_reader :ocarina, :ocarina_down, :ocarina_right, :ocarina_up, :ocarina_left
alias tsu_initialize initialize
def initialize
@ocarina = []
##############################################
@ocarina_down = "001-System01"
@ocarina_left = "002-System02"
@ocarina_right = "003-System03"
@ocarina_up = "004-System04"
##############################################
@ocarina[0] = []
@ocarina[0][0] = 4 #NOTE 1
@ocarina[0][1] = 4 #NOTE 2
@ocarina[0][2] = 6 #NOTE 3
@ocarina[0][3] = 6 #NOTE 4
@ocarina[0][4] = 2 #NOTE 5
@ocarina[0][5] = 2 #NOTE 6
@ocarina[0][6] = "Bolero of fire" #NAME OF THE SONG, IT WILL APPEAR AFTER THE PERFORMANCE
@ocarina[0][7] = Color.new(0, 255, 0) #ARROW'S OPACITY
@ocarina[0][8] = "116-Raise02" #SOUND (SE) WHEN YOU SUCCESFULLY PERFOM THE SONG
@ocarina[0][9] = 5 #SWITH THAT THE SUCCESFULL SONG WILL TURN ON.
@ocarina[1] = []
@ocarina[1][0] = 8
@ocarina[1][1] = 2
@ocarina[1][2] = 2
@ocarina[1][3] = 8
@ocarina[1][4] = 2
@ocarina[1][5] = 2
@ocarina[1][6] = "Song of war"
@ocarina[1][7] = Color.new(255, 0, 0)
@ocarina[1][8] = "116-Raise02"
@ocarina[1][9] = 4
@ocarina[1] = []
@ocarina[1][0] = 4
@ocarina[1][1] = 2
@ocarina[1][2] = 4
@ocarina[1][3] = 6
@ocarina[1][4] = 2
@ocarina[1][5] = 2
@ocarina[1][6] = "Song of healing"
@ocarina[1][7] = Color.new(255, 0, 0)
@ocarina[1][8] = "116-Raise02"
@ocarina[1][9] = 6
##############################################
tsu_initialize
end
end
class Ocarina
def main
@spriteset = Spriteset_Map.new
@ocarina_window = Window_Ocarina.new
Graphics.transition
loop do
Graphics.update
Input.update
@ocarina_window.update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@ocarina_window.dispose
end
end
class Window_Ocarina < Window_Base
def initialize
super(0, 280, 640, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@song = []
@correct = false
@counter = 0
refresh
end
def refresh
self.contents.clear
@back = Sprite.new
@back.bitmap = RPG::Cache.picture("pentagrama")
@back.x = 40
@back.y = 360
@back.opacity = 160
end
def update
if @correct
if @counter == 0
self.contents.font.color = $game_system.ocarina[@i][7]
self.contents.draw_text(0, 0, 618, 48, $game_system.ocarina[@i][6], 1)
Audio.se_play("Audio/SE/" + $game_system.ocarina[@i][8], 80, 100)
@arrow1.opacity = 255
@arrow2.opacity = 255
@arrow3.opacity = 255
@arrow4.opacity = 255
@arrow5.opacity = 255
@arrow6.opacity = 255
$game_switches[$game_system.ocarina[@i][9]] = true
end
@counter += 1
if @counter >= 200
@back.dispose
@back.bitmap.dispose
@arrow1.dispose
@arrow1.bitmap.dispose
@arrow2.dispose
@arrow2.bitmap.dispose
@arrow3.dispose
@arrow3.bitmap.dispose
@arrow4.dispose
@arrow4.bitmap.dispose
@arrow5.dispose
@arrow5.bitmap.dispose
@arrow6.dispose
@arrow6.bitmap.dispose
$scene = Scene_Map.new
$game_map.autoplay
$game_map.refresh
end
else
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@back.dispose
@back.bitmap.dispose
if @arrow1 != nil
@arrow1.dispose
@arrow1.bitmap.dispose
end
if @arrow2 != nil
@arrow2.dispose
@arrow2.bitmap.dispose
end
if @arrow3 != nil
@arrow3.dispose
@arrow3.bitmap.dispose
end
if @arrow4 != nil
@arrow4.dispose
@arrow4.bitmap.dispose
end
if @arrow5 != nil
@arrow5.dispose
@arrow5.bitmap.dispose
end
if @arrow6 != nil
@arrow6.dispose
@arrow6.bitmap.dispose
end
$scene = Scene_Map.new
$game_map.autoplay
$game_map.refresh
end
if Input.trigger?(Input::DOWN)
Audio.se_play("Audio/SE/" + $game_system.ocarina_down, 80, 100)
@song.push(2)
case @song.size
when 1
@arrow1 = Sprite.new
@arrow1.bitmap = RPG::Cache.picture("arrow")
@arrow1.angle = 180
@arrow1.opacity = 160
@arrow1.ox = @arrow1.bitmap.width / 2
@arrow1.oy = @arrow1.bitmap.height / 2
@arrow1.x = 160
@arrow1.y = 440
when 2
@arrow2 = Sprite.new
@arrow2.bitmap = RPG::Cache.picture("arrow")
@arrow2.angle = 180
@arrow2.opacity = 160
@arrow2.ox = @arrow2.bitmap.width / 2
@arrow2.oy = @arrow2.bitmap.height / 2
@arrow2.x = 240
@arrow2.y = 440
when 3
@arrow3 = Sprite.new
@arrow3.bitmap = RPG::Cache.picture("arrow")
@arrow3.angle = 180
@arrow3.opacity = 160
@arrow3.ox = @arrow3.bitmap.width / 2
@arrow3.oy = @arrow3.bitmap.height / 2
@arrow3.x = 320
@arrow3.y = 440
when 4
@arrow4 = Sprite.new
@arrow4.bitmap = RPG::Cache.picture("arrow")
@arrow4.angle = 180
@arrow4.opacity = 160
@arrow4.ox = @arrow4.bitmap.width / 2
@arrow4.oy = @arrow4.bitmap.height / 2
@arrow4.x = 400
@arrow4.y = 440
when 5
@arrow5 = Sprite.new
@arrow5.bitmap = RPG::Cache.picture("arrow")
@arrow5.angle = 180
@arrow5.opacity = 160
@arrow5.ox = @arrow5.bitmap.width / 2
@arrow5.oy = @arrow5.bitmap.height / 2
@arrow5.x = 480
@arrow5.y = 440
when 6
@arrow6 = Sprite.new
@arrow6.bitmap = RPG::Cache.picture("arrow")
@arrow6.angle = 180
@arrow6.opacity = 160
@arrow6.ox = @arrow6.bitmap.width / 2
@arrow6.oy = @arrow6.bitmap.height / 2
@arrow6.x = 560
@arrow6.y = 440
end
end
if Input.trigger?(Input::LEFT)
Audio.se_play("Audio/SE/" + $game_system.ocarina_left, 80, 100)
@song.push(4)
case @song.size
when 1
@arrow1 = Sprite.new
@arrow1.bitmap = RPG::Cache.picture("arrow")
@arrow1.angle = 90
@arrow1.opacity = 160
@arrow1.ox = @arrow1.bitmap.width / 2
@arrow1.oy = @arrow1.bitmap.height / 2
@arrow1.x = 160
@arrow1.y = 420
when 2
@arrow2 = Sprite.new
@arrow2.bitmap = RPG::Cache.picture("arrow")
@arrow2.angle = 90
@arrow2.opacity = 160
@arrow2.ox = @arrow2.bitmap.width / 2
@arrow2.oy = @arrow2.bitmap.height / 2
@arrow2.x = 240
@arrow2.y = 420
when 3
@arrow3 = Sprite.new
@arrow3.bitmap = RPG::Cache.picture("arrow")
@arrow3.angle = 90
@arrow3.opacity = 160
@arrow3.ox = @arrow3.bitmap.width / 2
@arrow3.oy = @arrow3.bitmap.height / 2
@arrow3.x = 320
@arrow3.y = 420
when 4
@arrow4 = Sprite.new
@arrow4.bitmap = RPG::Cache.picture("arrow")
@arrow4.angle = 90
@arrow4.opacity = 160
@arrow4.ox = @arrow4.bitmap.width / 2
@arrow4.oy = @arrow4.bitmap.height / 2
@arrow4.x = 400
@arrow4.y = 420
when 5
@arrow5 = Sprite.new
@arrow5.bitmap = RPG::Cache.picture("arrow")
@arrow5.angle = 90
@arrow5.opacity = 160
@arrow5.ox = @arrow5.bitmap.width / 2
@arrow5.oy = @arrow5.bitmap.height / 2
@arrow5.x = 480
@arrow5.y = 420
when 6
@arrow6 = Sprite.new
@arrow6.bitmap = RPG::Cache.picture("arrow")
@arrow6.angle = 90
@arrow6.opacity = 160
@arrow6.ox = @arrow6.bitmap.width / 2
@arrow6.oy = @arrow6.bitmap.height / 2
@arrow6.x = 560
@arrow6.y = 420
end
end
if Input.trigger?(Input::RIGHT)
Audio.se_play("Audio/SE/" + $game_system.ocarina_right, 80, 100)
@song.push(6)
case @song.size
when 1
@arrow1 = Sprite.new
@arrow1.bitmap = RPG::Cache.picture("arrow")
@arrow1.angle = 270
@arrow1.opacity = 160
@arrow1.ox = @arrow1.bitmap.width / 2
@arrow1.oy = @arrow1.bitmap.height / 2
@arrow1.x = 160
@arrow1.y = 400
when 2
@arrow2 = Sprite.new
@arrow2.bitmap = RPG::Cache.picture("arrow")
@arrow2.angle = 270
@arrow2.opacity = 160
@arrow2.ox = @arrow2.bitmap.width / 2
@arrow2.oy = @arrow2.bitmap.height / 2
@arrow2.x = 240
@arrow2.y = 400
when 3
@arrow3 = Sprite.new
@arrow3.bitmap = RPG::Cache.picture("arrow")
@arrow3.angle = 270
@arrow3.opacity = 160
@arrow3.ox = @arrow3.bitmap.width / 2
@arrow3.oy = @arrow3.bitmap.height / 2
@arrow3.x = 320
@arrow3.y = 400
when 4
@arrow4 = Sprite.new
@arrow4.bitmap = RPG::Cache.picture("arrow")
@arrow4.angle = 270
@arrow4.opacity = 160
@arrow4.ox = @arrow4.bitmap.width / 2
@arrow4.oy = @arrow4.bitmap.height / 2
@arrow4.x = 400
@arrow4.y = 400
when 5
@arrow5 = Sprite.new
@arrow5.bitmap = RPG::Cache.picture("arrow")
@arrow5.angle = 270
@arrow5.opacity = 160
@arrow5.ox = @arrow5.bitmap.width / 2
@arrow5.oy = @arrow5.bitmap.height / 2
@arrow5.x = 480
@arrow5.y = 400
when 6
@arrow6 = Sprite.new
@arrow6.bitmap = RPG::Cache.picture("arrow")
@arrow6.angle = 270
@arrow6.opacity = 160
@arrow6.ox = @arrow6.bitmap.width / 2
@arrow6.oy = @arrow6.bitmap.height / 2
@arrow6.x = 560
@arrow6.y = 400
end
end
if Input.trigger?(Input::UP)
Audio.se_play("Audio/SE/" + $game_system.ocarina_up, 80, 100)
@song.push(8)
case @song.size
when 1
@arrow1 = Sprite.new
@arrow1.bitmap = RPG::Cache.picture("arrow")
@arrow1.opacity = 160
@arrow1.ox = @arrow1.bitmap.width / 2
@arrow1.oy = @arrow1.bitmap.height / 2
@arrow1.x = 160
@arrow1.y = 380
when 2
@arrow2 = Sprite.new
@arrow2.bitmap = RPG::Cache.picture("arrow")
@arrow2.opacity = 160
@arrow2.ox = @arrow2.bitmap.width / 2
@arrow2.oy = @arrow2.bitmap.height / 2
@arrow2.x = 240
@arrow2.y = 380
when 3
@arrow3 = Sprite.new
@arrow3.bitmap = RPG::Cache.picture("arrow")
@arrow3.opacity = 160
@arrow3.ox = @arrow3.bitmap.width / 2
@arrow3.oy = @arrow3.bitmap.height / 2
@arrow3.x = 320
@arrow3.y = 380
when 4
@arrow4 = Sprite.new
@arrow4.bitmap = RPG::Cache.picture("arrow")
@arrow4.opacity = 160
@arrow4.ox = @arrow4.bitmap.width / 2
@arrow4.oy = @arrow4.bitmap.height / 2
@arrow4.x = 400
@arrow4.y = 380
when 5
@arrow5 = Sprite.new
@arrow5.bitmap = RPG::Cache.picture("arrow")
@arrow5.opacity = 160
@arrow5.ox = @arrow5.bitmap.width / 2
@arrow5.oy = @arrow5.bitmap.height / 2
@arrow5.x = 480
@arrow5.y = 380
when 6
@arrow6 = Sprite.new
@arrow6.bitmap = RPG::Cache.picture("arrow")
@arrow6.opacity = 160
@arrow6.ox = @arrow6.bitmap.width / 2
@arrow6.oy = @arrow6.bitmap.height / 2
@arrow6.x = 560
@arrow6.y = 380
end
end
if @song.size >= 6
for @i in 0...$game_system.ocarina.size
if @song[0] == $game_system.ocarina[@i][0] &&
@song[1] == $game_system.ocarina[@i][1] &&
@song[2] == $game_system.ocarina[@i][2] &&
@song[3] == $game_system.ocarina[@i][3] &&
@song[4] == $game_system.ocarina[@i][4] &&
@song[5] == $game_system.ocarina[@i][5]
@correct = true
break
end
end
end
if @song.size >= 6 && @correct == false
@counter += 1
if @counter >= 40
@back.dispose
@back.bitmap.dispose
@arrow1.dispose
@arrow1.bitmap.dispose
@arrow2.dispose
@arrow2.bitmap.dispose
@arrow3.dispose
@arrow3.bitmap.dispose
@arrow4.dispose
@arrow4.bitmap.dispose
@arrow5.dispose
@arrow5.bitmap.dispose
@arrow6.dispose
@arrow6.bitmap.dispose
$scene = Scene_Map.new
end
end
end
end
end