Sha256: 54d3d32115f9667f21e80e8825f65dbce6a184cc70d79967099596039a54320a

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

describe Joybox::Actions::Jump do
  behaves_like "Action Sprite"

  it "should jump the sprite by position" do
    @sprite.run_action Jump.by position: [15, 15], height: 15
    @sprite.position.should == CGPointMake(5, 5)

    wait 0.2 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.not.be.close 20, 0.1
      @sprite.position.y.should.not.be.close 20, 0.1
    end

    wait 0.5 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.be.close 20, 0.1
      @sprite.position.y.should.be.close 20, 0.1
    end
  end

  it "should jump the sprite to position" do
    @sprite.run_action Jump.to position: [10, 10], height: 15   
    @sprite.position.should == CGPointMake(5, 5)

    wait 0.2 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.not.be.close 10, 0.1
      @sprite.position.y.should.not.be.close 10, 0.1
    end

    wait 0.5 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.be.close 10, 0.1
      @sprite.position.y.should.be.close 10, 0.1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 spec/motion/joybox/actions/jump_spec.rb
joybox-1.1.0 spec/motion/joybox/actions/jump_spec.rb