TheoAllen

Iseng2 RGSSS3 (2)

Apr 16th, 2013
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.56 KB | None | 0 0
  1. #==============================================================================
  2. # ** Main
  3. #------------------------------------------------------------------------------
  4. #  This processing is executed after module and class definition is finished.
  5. #==============================================================================
  6.  
  7. #rgss_main { SceneManager.run }
  8. DataManager.init
  9.  
  10. def start
  11.   bitmap = Cache.battler("bat",0)
  12.   $sprite.bitmap = bitmap
  13.   puts "start"
  14. end
  15.  
  16. def post_start
  17.   $sprite.x = Graphics.width - $sprite.width
  18.   $sprite.y = Graphics.height -  $sprite.height
  19.   puts "post start"
  20. end
  21.  
  22. def updates
  23.   Graphics.update
  24.   Input.update
  25.   $sprite.update
  26.   update_movement
  27.   update_flash
  28.   update_jump
  29. end
  30.  
  31. def update_movement
  32.   case Input.dir8
  33.   when 1
  34.     $sprite.x -= 3
  35.     $sprite.y += 3
  36.   when 2
  37.     $sprite.y += 3
  38.   when 3
  39.     $sprite.x += 3
  40.     $sprite.y += 3
  41.   when 4
  42.     $sprite.x -= 3
  43.   when 6
  44.     $sprite.x += 3
  45.   when 7
  46.     $sprite.x -= 3
  47.     $sprite.y -= 3
  48.   when 8
  49.     $sprite.y -= 3
  50.   when 9
  51.     $sprite.x += 3
  52.     $sprite.y -= 3
  53.   end
  54. end
  55.  
  56. def update_flash
  57.   if Input.trigger?(:CTRL)
  58.     color = Color.new(255,255,255)
  59.     $sprite.flash(color,60)
  60.   end
  61. end
  62.  
  63. def update_jump
  64.   if Input.trigger?(:ALT)
  65.     jump_height = 20
  66.     $sprite.y -= jump_height
  67.     while $sprite.y < Graphics.height
  68.       Graphics.update
  69.       jump_height -= 1
  70.       puts jump_height
  71.       $sprite.y -= jump_height
  72.     end
  73.   end
  74. end
  75.  
  76. view = Viewport.new
  77. $sprite = Sprite.new(view)
  78.  
  79. start
  80. post_start
  81. updates while true
Advertisement
Add Comment
Please, Sign In to add comment