Operators

Home » JS, HTML & CSS References » Operators

Add

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Subtract

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Multiply

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Divide

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Pick Random

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Greater Than

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Less Than

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Equal To

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

AND

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

OR

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

NOT

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})

Join

isTouchingEdge()
// 'bottom', 'top', 'left' or 'right'
// Example: isTouchingEdge 'bottom', 'top', 'left' or 'right'
exampleSprite_sprite.whenFlag(function () {
        
    while(true){                                                   
        this.changeY(-2)
        if (this.isTouchingEdge('bottom')) {
            this.say ('touching bottom edge')
        } else {
            this.say('not touching bottom edge')
        }
    }       
})