Scratch for Java

Sprite::isColorTouchingColor()

Checks whether a colour of the sprite is touching a colour on the stage: only the parts of the costume painted in color count. A car whose front bumper is red can ask whether the bumper touches the grass.

if (this.isColorTouchingColor(HtmlColor.RED, HtmlColor.GREEN)) {
   this.say("Off the road!");
 }

Examples

View on GitHub

Syntax

Java

.isColorTouchingColor(color, other)

Scratch

<color [#ff0000] is touching [#00ff00]?>

Parameters

Name Data Type Description
color Color a colour of this sprite's costume
other Color the colour to look for under it

Return

boolean

isColorTouchingColor()

Create Shareable URL

Select Sections