FilipsO - Sro 21 Lip, 2010 13:42 Temat postu: Skrypt na title'a w rogu ekranuWitajcie dziś napisałem skrypt na nazwę title'a w rogu ekranu.
Oto on:
Spoiler:
Kod:
class Window_okno < Window_Base
def initialize(x = 7, y = 16, width = 320, height = 60)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
self.back_opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 288, 32, "Nazwa titla", 1)
end
end
A teraz scene_map podmieniamy na to:
Spoiler:
Kod:
class Window_okno < Window_Base
def initialize(x = 7, y = 16, width = 320, height = 60)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 18
self.back_opacity = 160
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 288, 32, "Nazwa titla", 1)
end
end
class Scene_Map
def main
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
@okienko = Window_okno.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@message_window.dispose
@okienko.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
loop do
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
@okienko.refresh
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
def transfer_player
$game_temp.player_transferring = false
if $game_map.map_id != $game_temp.player_new_map_id
$game_map.setup($game_temp.player_new_map_id)
end
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
case $game_temp.player_new_direction
when 2
$game_player.turn_down
when 4
$game_player.turn_left
when 6
$game_player.turn_right
when 8
$game_player.turn_up
end
$game_player.straighten
$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
if $game_temp.transition_processing
$game_temp.transition_processing = false
Graphics.transition(20)
end
$game_map.autoplay
Graphics.frame_reset
Input.update
end
end
Yoroiookami - Sro 21 Lip, 2010 15:57 Mógłbyś zamieścić screena. :PFilipsO - Sro 21 Lip, 2010 16:01 Prosze oto screen:
Yoroiookami - Sro 21 Lip, 2010 16:03 Cóż, ciekawy skrypt...nie wiem jednak czy będzie przydatny, można to w końcu zwyczajnie zrobić przy pomocy "Pokaż obrazek", tak żeby nie zablokować gracza >_>
Być może komuś się przyda.FilipsO - Sro 21 Lip, 2010 17:18 No oceniajcie Sabikku - Sro 21 Lip, 2010 17:22 Nie za bardzo praktyczny, widział ty w jakiejś grze jej nazwę na mapie? :)FilipsO - Sro 21 Lip, 2010 17:25 Nie Ale możesz tam wpisać np: Skacz "Z" lub cokolwiek chcesz.PaKiTos - Czw 22 Lip, 2010 10:10 można to se podrasować że tekst zależy od przełącznika 6/10 nawet może byćMantiq - Pią 17 Cze, 2011 20:08 To nie jest twój skrypt tylko pw115 :P
Widzię, że Ruby jest ci bardzooooooooooooooooo obce.Melvin - Pią 17 Cze, 2011 20:56 Dobry pomysł... Biorę.Feniks - Pią 17 Cze, 2011 22:09 Ciekawy, ale mi akurat zbędny, może do innego projektu... Tak czy inaczej fajnie wygląda ^^.^^