Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Window_Czas
- #==============================================================================
- class Window_Czas < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 64, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- @czas = 0
- @czas_old = 0
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if @czas != @czas_old #żeby nie odświeżało niepotrzebnie, tak samo możesz
- # zrobić z punktami jak je dodasz
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(-5, 0, 32, 32, @czas.to_s, 2)
- self.contents.font.color = system_color
- end
- end
- #--------------------------------------------------------------------------
- # * Update_czas
- #--------------------------------------------------------------------------
- def update_czas(czas)
- @czas_old = @czas
- @czas = czas
- update #musi być zrobione na odwrót, ale efekt jest ten sam
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- end
- end
- #==============================================================================
- # ** Window_Punkty
- #==============================================================================
- class Window_Punkty < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 128, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.font.color = system_color
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- end
- end
- #==============================================================================
- # ** Scene_Zamki
- #==============================================================================
- class Scene_Zamki
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- @czas_window = Window_Czas.new
- @czas_window.back_opacity = 120
- @czas_window.y = 416
- @pkt_window = Window_Punkty.new
- @pkt_window.back_opacity = 120
- @pkt_window.x = 64
- @pkt_window.y = 416
- @odliczanie = false
- @czas = 0
- @spriteset = Spriteset_Map.new #spriteset tworzy się w scenie, nie w każdym
- # oknie oddzielnie
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @czas_window.dispose
- @pkt_window.dispose
- @spriteset.dispose #nie usuwałem spritesetu, to był powód kraszów
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- if @odliczanie
- czas = @czas / Graphics.frame_rate #obliczania wykonuj tutaj i przekazuj
- # wynik do okna. nie ma sensu robić
- # tysiąca zmiennych globalnych
- @czas += 1
- end
- @czas_window.update_czas(czas)
- @pkt_window.update
- if Input.trigger?(Input::B)
- $scene = Scene_Map.new
- end
- if Input.trigger?(Input::C)
- odliczanie
- end
- end
- #--------------------------------------------------------------------------
- # * Odliczanie
- #--------------------------------------------------------------------------
- def odliczanie
- @odliczanie = !@odliczanie
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment