miyako/sample/anim_sample.rb

#! /usr/bin/ruby
# ¥¢¥Ë¥á¡¼¥·¥ç¥ó¥¹¥×¥é¥¤¥È¥Æ¥¹¥È

$LOAD_PATH.push("../")

require 'miyako'

module Miyako
  w = 0.1

  @spr1 = Sprite.new("anim_sprite_01.png")
  @spr1.oh = @spr1.ow

  @as1 = SpriteAnimation.new(@spr1, w)
  @as1.show
  @as1.start

  @spr2 = Sprite.new("anim_sprite_02.png")
  @spr2.ow = 32
  @spr2.oh = 32
  @spr2.y  = 32

  @as2 = SpriteAnimation.new(@spr2, w)
  @as2.show
  @as2.start

  loop do
    Input.update

    if Input.quit? || Input.pushedEscape?
      break
    end
    if Input.pushed?(Input::BTN1)
      @as1.toggle_visible
      @as2.toggle_visible
    end
    if Input.pushed?(Input::BTN2)
      @as1.toggle_exec
      @as2.toggle_exec
    end
    @as2.move_character(Input.pushedAmount[0])
    @as1.update
    @as2.update
    Screen.update
  end

end
harpýÁpôà0$