Permalink
Browse files

Add basic movement and options when escape pressed. Options must be c…

…hanges
  • Loading branch information...
1 parent 14c78ae commit b14196a4cd297d3bf2cfce8b2f7f6f7f3ce51df6 @divins divins committed Feb 20, 2012
Showing with 12 additions and 12 deletions.
  1. +12 −12 lib/rpg/scenes/main_game.rb
@@ -14,13 +14,14 @@ def setup
@sprite.sheet_size = [4, 4]
@camera = Ray::View.new @sprite.pos, window.size
@text = text "Oh Man", :size => 30
- basic_movement
end
def register
+ in_game_options
end
def render(win)
+ always
win.draw @sky
win.draw @text
@@ -32,18 +33,17 @@ def render(win)
def clean_up
end
- def basic_movement
- on :key_press, key(:up) do
- animations << sprite_animation(:from => [0, 3], :to => [4, 3],
- :duration => 0.3).start(@sprite)
- animations << translation(:of => [0, -32], :duration => 0.3).start(@sprite)
- end
- on :key_press, key(:down) do
- animations << sprite_animation(:from => [0, 0], :to => [4, 0],
- :duration => 0.3).start(@sprite)
- animations << translation(:of => [0, 32], :duration => 0.3).start(@sprite)
+ def always
+ movements
+ end
+
+ def in_game_options
+ on :key_press, key(:escape) do
+ run_scene :options
end
- puts 'wtf'
+ end
+
+ def movements
if animations.empty?
if holding? :down
animations << sprite_animation(:from => [0, 0], :to => [4, 0],

0 comments on commit b14196a

Please sign in to comment.