#~ #============================================================================== #~ # ** Main #~ #------------------------------------------------------------------------------ #~ # This processing is executed after module and class definition is finished. #~ #============================================================================== #~ rgss_main { SceneManager.run } DataManager.init # ======================== module THEO SPEED = 3 end class Scene def initialize clear_jump_info end def clear_jump_info @jump_x = 0 @jump_y = 0 @x_speed = 0.0 @y_speed = 0.0 @real_x = 0.0 @real_y = 0.0 end def updates Graphics.update Input.update update_placement input_jump update_jump if jumping? end def update_placement if Input.press?(:RIGHT) $window.x += THEO::SPEED elsif Input.press?(:LEFT) $window.x -= THEO::SPEED elsif Input.press?(:UP) $window.y -= THEO::SPEED elsif Input.press?(:DOWN) $window.y += THEO::SPEED end end def input_jump if Input.trigger?(:ALT) jump_to(100,100) end end def jump_to(x,y) @jump_x = x @jump_y = y @real_x = $window.x.to_f @real_y = $window.y.to_f determine_speed end def jumping? return false if @jump_x == 0 && @jump_y == 0 return $window.x != @jump_x || $window.y != @jump_y end def update_jump @real_x += @x_speed @real_y += @y_speed $window.x = @real_x.round $window.y = @real_y.round puts @jump_x puts @real_x clear_jump_info if $window.x == @jump_x && $window.y == @jump_y end def determine_speed @x_speed = (@jump_x - $window.x) / 60.0 @y_speed = (@jump_y - $window.y) / 60.0 end end ww = 24 wh = 24 wx = Graphics.width - ww wy = 100 $window = Window_Base.new(wx,wy,ww,wh) $window.x = 300 $window.y = 300 main = Scene.new main.updates while true # ========================