Skip to content

Commit 7b589af

Browse files
Update main.ts
1 parent d188533 commit 7b589af

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

main.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ class Circle {
4747
}
4848
this._sprite = sprites.create(this._img)
4949
}
50-
//% group="Properties"
51-
//% blockSetVariable="myCircle"
52-
//% blockCombine block="sprite"
53-
get circle(): Sprite {
54-
return this._sprite;
55-
}
50+
5651
//% group="Properties"
5752
//% blockSetVariable="myCircle"
5853
//% blockCombine block="data number"
@@ -102,7 +97,12 @@ class Circle {
10297
set text(value: string) {
10398
this._dataText = value;
10499
}
105-
100+
//% group="Properties"
101+
//% blockSetVariable="myCircle"
102+
//% blockCombine block="sprite"
103+
get circle(): Sprite {
104+
return this._sprite;
105+
}
106106
//% group="Actions"
107107
//% block="fill %Circle(myCircle) || with color $color"
108108
fill(color: number = -1 ){
@@ -190,16 +190,14 @@ class CircleList{
190190
/*
191191
middle
192192
*/
193-
194-
195193
//% group="List Middle"
196-
//% block="%myCircleList get circle at %index"
197-
getCircleAt(index:number):Circle {
198-
if(index < this.length() )
194+
//% block="%myCircleList remove and destroy circle at %index"
195+
removeAndDestroyCircleAt(index:number){
196+
if(this.length() > 0)
199197
{
200-
return this._circles[index]
198+
let tmp = this._circles.removeAt(index)
199+
tmp.destroy()
201200
}
202-
return null
203201
}
204202
//% group="List Middle"
205203
//% block="%myCircleList get and remove circle at %index"
@@ -211,13 +209,13 @@ class CircleList{
211209
return null
212210
}
213211
//% group="List Middle"
214-
//% block="%myCircleList remove and destroy circle at %index"
215-
removeAndDestroyCircleAt(index:number){
216-
if(this.length() > 0)
212+
//% block="%myCircleList get circle at %index"
213+
getCircleAt(index:number):Circle {
214+
if(index < this.length() )
217215
{
218-
let tmp = this._circles.removeAt(index)
219-
tmp.destroy()
216+
return this._circles[index]
220217
}
218+
return null
221219
}
222220
//% group="List Middle"
223221
//% block="%myCircleList set circle at %index to %value=variables_get(myCircle)"

0 commit comments

Comments
 (0)