Skip to content

Commit bedf07e

Browse files
added list get circle with sprite
1 parent 1dbee6f commit bedf07e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Circle {
106106
//% group="Properties"
107107
//% blockSetVariable="myCircle"
108108
//% blockCombine block="sprite"
109-
get circle(): Sprite {
109+
get sprite(): Sprite {
110110
return this._sprite;
111111
}
112112
//% group="Actions"
@@ -217,6 +217,14 @@ class CircleList{
217217
return null
218218
}
219219
//% group="List Middle"
220+
//% block="%myCircleList get circle with sprite %mySprite"
221+
getCircleWithSprite(s:Sprite):Circle {
222+
for(let i = 0; i < this.length(); i++) {
223+
if(this._circles[i].sprite == s) return this._circles[i]
224+
}
225+
return null
226+
}
227+
//% group="List Middle"
220228
//% block="%myCircleList get circle at %index"
221229
getCircleAt(index:number):Circle {
222230
if(index < this.length() )

0 commit comments

Comments
 (0)