Sensor event triggers only once

Issue #3 resolved
Yuriy Voziy created an issue

Steps to reproduce: Go to url: http://bitsquest.bitbucket.org/index.html#2

run this code:

this.on('start', function() {
    this.thrusters.right(true);
    this.on('sensor:left', function(contact) {
        console.log('left ' + contact)
        this.thrusters.left(true)
        this.thrusters.right(false)
    });
    this.on('sensor:right', function(contact) {
        console.log('right ' + contact);
        this.thrusters.left(false);
        this.thrusters.right(true);
    })
})

Expected result: the robot goes in both directions from one wall to another

Actual result: Robot stops on the second iteration

Comments (5)

  1. Daniel Bennett Account Deactivated

    Sensors should fire correctly with both false and true "touching" statuses. Give it a shot now.

  2. Log in to comment