diff --git a/data/img/other/minigl.png b/data/img/other/minigl.png new file mode 100644 index 0000000..b45a042 Binary files /dev/null and b/data/img/other/minigl.png differ diff --git a/data/text/english.txt b/data/text/english.txt index 1ec3f13..45fbe54 100644 --- a/data/text/english.txt +++ b/data/text/english.txt @@ -1,3 +1,5 @@ +powered_by Powered by +game_by A game by play Play instructions Instructions options Options diff --git a/data/text/portuguese.txt b/data/text/portuguese.txt index 30c4641..a1b8d09 100644 --- a/data/text/portuguese.txt +++ b/data/text/portuguese.txt @@ -1,3 +1,5 @@ +powered_by Feito com +game_by Um jogo por play Jogar instructions Instruções options Opções diff --git a/data/text/spanish.txt b/data/text/spanish.txt index ff2aaff..114e47b 100644 --- a/data/text/spanish.txt +++ b/data/text/spanish.txt @@ -1,3 +1,5 @@ +powered_by Desarrollado con +game_by Un juego de play Jugar instructions Instrucciones options Opciones diff --git a/src/game.rb b/src/game.rb index cad0064..e6e8a0a 100644 --- a/src/game.rb +++ b/src/game.rb @@ -1,5 +1,6 @@ require 'rbconfig' require 'fileutils' +require_relative 'presentation' require_relative 'menu' require_relative 'basic_mode' require_relative 'dynamic_mode' @@ -65,7 +66,7 @@ def initialize @font = Res.font(:arialRounded, 24) @text_helper = TextHelper.new(@font) - @controller = Menu.new + @controller = Presentation.new end def play_song(id) @@ -122,6 +123,10 @@ def save_scores end end + def show_menu(force_main = false) + @controller = Menu.new(@controller.is_a?(StaticMode) && !force_main ? :static_level : :main) + end + def start_basic @controller = BasicMode.new end @@ -144,10 +149,6 @@ def add_score(table_index, rank, name, score) save_scores end - def quit(force_main = false) - @controller = Menu.new(@controller.is_a?(StaticMode) && !force_main ? :static_level : :main) - end - def update if KB.key_down?(Gosu::KB_LEFT_ALT) && KB.key_pressed?(Gosu::KB_RETURN) @full_screen = !@full_screen diff --git a/src/game_mode.rb b/src/game_mode.rb index 228819e..0c7f6b0 100644 --- a/src/game_mode.rb +++ b/src/game_mode.rb @@ -25,7 +25,7 @@ def initialize end, Button.new(585, 201, :exit) do if @game_over - Game.quit + Game.show_menu else @confirmation = :exit end @@ -38,7 +38,7 @@ def initialize if @confirmation == :restart start else - Game.quit + Game.show_menu end end, Button.new(420, 330, :no, true) do diff --git a/src/menu.rb b/src/menu.rb index 9339152..d00fd9d 100644 --- a/src/menu.rb +++ b/src/menu.rb @@ -100,8 +100,6 @@ def initialize(state = :main) instructions: 5, high_scores: 5 } - - Game.play_song(:spheresTheme) end def set_page(state, num) diff --git a/src/presentation.rb b/src/presentation.rb new file mode 100644 index 0000000..67cc9c1 --- /dev/null +++ b/src/presentation.rb @@ -0,0 +1,32 @@ +class Presentation + AUTHOR_NAME = 'Victor David Santos' + + def initialize + @logo = Res.img(:other_minigl) + @timer = 0 + + Game.play_song(:spheresTheme) + end + + def update + @timer += 1 + Game.show_menu if @timer == 440 || Mouse.button_pressed?(:left) + end + + def draw + if @timer <= 220 + t = [110, @timer].min + w = @logo.width / 2 + x = (-w + (t / 110.0) * (SCREEN_WIDTH / 2 + w)).round + alpha = @timer <= 190 ? 255 : 255 - (((@timer - 190) / 30.0) * 255).round + @logo.draw(x - w, (SCREEN_HEIGHT - @logo.height) / 2, 0, 1, 1, (alpha << 24) | 0xffffff) + Game.text_helper.write_line(Locl.text(:powered_by), x, (SCREEN_HEIGHT - @logo.height) / 2 - 40, :center, 0xffffff, alpha) + else + t = [110, @timer - 220].min + w = Game.font.text_width(AUTHOR_NAME) * 1.5 / 2 + x = (SCREEN_WIDTH + w - (t / 110.0) * (SCREEN_WIDTH / 2 + w)).round + Game.text_helper.write_line(Locl.text(:game_by), x, SCREEN_HEIGHT / 2 - 40, :center, 0xffffff) + Game.text_helper.write_line(AUTHOR_NAME, x, SCREEN_HEIGHT / 2 - 10, :center, 0xffffff, 255, nil, 0, 0, 0, 0, 1.5, 1.5) + end + end +end diff --git a/src/static_mode.rb b/src/static_mode.rb index 50b85ec..51940d5 100644 --- a/src/static_mode.rb +++ b/src/static_mode.rb @@ -74,7 +74,7 @@ def update @timer = 120 end else - Game.quit(true) + Game.show_menu(true) end end return