Class: Kawaii::Intro
Instance Attribute Summary
Attributes inherited from Scene
#name, #scene_manager, #transition_duration
Instance Method Summary collapse
- #draw ⇒ Object
- #load ⇒ Object
- #transition_in(current, duration) ⇒ Object
- #transition_out(current, duration) ⇒ Object
- #update(dt) ⇒ Object
Methods inherited from Scene
#add_child, #after_draw, #after_update, #before_draw, #before_update, #draw_hud, #game, #initialize, #remove_child
Constructor Details
This class inherits a constructor from Kawaii::Scene
Instance Method Details
#draw ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/kawaii/intro.rb', line 36 def draw @logo.draw_rot(@position.x, @position.y, 0, @rotation, 0.5, 0.5, @scale, @scale) game.draw_quad( 0, 0, @color, game.width, 0, @color, game.width, game.height, @color, 0, game.height, @color, ) end |
#load ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/kawaii/intro.rb', line 4 def load @logo = Gosu::Image.new(game(), File.dirname(__FILE__) + '/logo.png', false) @rotation = 0 @position = Vector2.new(game().width / 2, game().height / 2) @scale = 1 @transition_duration = 2500 @color = Gosu::Color::WHITE @color.alpha = 0 end |
#transition_in(current, duration) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kawaii/intro.rb', line 14 def transition_in current, duration fake_duration = 750 dead_zone = 1200 if current <= fake_duration @rotation = Kawaii::clerp(0, (360 * 2) - 145, current / (fake_duration * 0.7)) @scale = Kawaii::clerp(0.1, 1.0, current / (fake_duration * 0.8)) elsif current <= dead_zone else @rotation = Kawaii::clerp(@rotation, 0, (current - dead_zone) / ((duration - dead_zone) * 1.4)) @scale = Kawaii::clerp(@scale, 0, (current - dead_zone) / ((duration - dead_zone) * 1.4)) @position.x = Kawaii::clerp(game().width / 2, game().width + 400, (current - dead_zone) / ((duration - dead_zone) * 1.3)) @position.y += 5 @color.alpha = Kawaii::clerp(0, 255, (current - dead_zone) / ((duration - dead_zone))) end end |
#transition_out(current, duration) ⇒ Object
30 31 |
# File 'lib/kawaii/intro.rb', line 30 def transition_out current, duration end |
#update(dt) ⇒ Object
33 34 |
# File 'lib/kawaii/intro.rb', line 33 def update dt end |