Sha256: 546d0cd58a94c5fdc772664f4715e3a035ab4f1b86be2eefe1bd0bca2f0d7121

Contents?: true

Size: 1000 Bytes

Versions: 5

Compression:

Stored size: 1000 Bytes

Contents

require 'helper'

describe "Using input mapper", acceptance: true do

  define_actor :foxy do
  end

  it 'sets actor state based on input' do
    game.stage do |stage| # instance of TestingStage
      foxy = create_actor :foxy
      foxy.controller.map_controls 'left'  => :move_left,
                                   'right' => :move_right,
                                   'd'     => :move_right
    end

    controller = game.actor(:foxy).controller
    controller.move_left?.should be_false
    controller.move_right?.should be_false

    press_key KbLeft
    press_key KbD

    controller.move_left?.should be_true
    controller.move_right?.should be_true

    release_key KbD
    controller.move_left?.should be_true
    controller.move_right?.should be_false


    press_key KbRight
    controller.move_left?.should be_true
    controller.move_right?.should be_true

    release_key KbRight
    controller.move_left?.should be_true
    controller.move_right?.should be_false
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gamebox-0.5.5 spec/acceptance/input_mapper_spec.rb
gamebox-0.5.4 spec/acceptance/input_mapper_spec.rb
gamebox-0.5.2 spec/acceptance/input_mapper_spec.rb
gamebox-0.5.1 spec/acceptance/input_mapper_spec.rb
gamebox-0.5.0 spec/acceptance/input_mapper_spec.rb