@@ -102,7 +102,6 @@ class Circle {
102102 get fillColor ( ) {
103103 return this . _fillColor ;
104104 }
105-
106105 //% group="Properties"
107106 //% blockSetVariable="myCircle"
108107 //% blockCombine block="sprite"
@@ -196,9 +195,35 @@ class CircleList{
196195 this . _circles . insertAt ( 0 , null )
197196 }
198197 /*
199- middle
198+ end
199+ */
200+ //% group="List End"
201+ //% block="%myCircleList remove and destroy last circle"
202+ removeAndDestroyLast ( ) {
203+ if ( this . length ( ) > 0 )
204+ {
205+ let tmp = this . _circles . removeAt ( this . length ( ) - 1 )
206+ tmp . destroy ( )
207+ }
208+ }
209+ //% group="List End"
210+ //% block="get and remove last circle from %myCircleList"
211+ getAndRemoveLast ( ) :Circle {
212+ if ( this . length ( ) > 0 ) {
213+ return this . _circles . removeAt ( this . length ( ) - 1 )
214+ }
215+ return null ;
216+ }
217+
218+ //% group="List End"
219+ //% block="%myCircleList add %value=variables_get(myCircle) to end"
220+ addCircleToEnd ( value :Circle ) {
221+ this . _circles . push ( value )
222+ }
223+ /*
224+ other
200225 */
201- //% group="List Middle "
226+ //% group="List Other "
202227 //% block="%myCircleList remove and destroy circle at %index"
203228 removeAndDestroyCircleAt ( index :number ) {
204229 if ( this . length ( ) > 0 )
@@ -207,7 +232,7 @@ class CircleList{
207232 tmp . destroy ( )
208233 }
209234 }
210- //% group="List Middle "
235+ //% group="List Other "
211236 //% block="%myCircleList get and remove circle at %index"
212237 getAndRemoveCircleAt ( index :number ) :Circle {
213238 if ( this . length ( ) > 0 )
@@ -216,15 +241,15 @@ class CircleList{
216241 }
217242 return null
218243 }
219- //% group="List Middle "
244+ //% group="List Other "
220245 //% block="%myCircleList get circle with sprite %mySprite"
221246 getCircleWithSprite ( s :Sprite ) :Circle {
222247 for ( let i = 0 ; i < this . length ( ) ; i ++ ) {
223248 if ( this . _circles [ i ] . sprite == s ) return this . _circles [ i ]
224249 }
225250 return null
226251 }
227- //% group="List Middle "
252+ //% group="List Other "
228253 //% block="%myCircleList get circle at %index"
229254 getCircleAt ( index :number ) :Circle {
230255 if ( index < this . length ( ) )
@@ -233,43 +258,18 @@ class CircleList{
233258 }
234259 return null
235260 }
236- //% group="List Middle "
261+ //% group="List Other "
237262 //% block="%myCircleList set circle at %index to %value=variables_get(myCircle)"
238263 setCircleAt ( index :number , value :Circle ) {
239264 if ( index < this . length ( ) ) {
240265 this . _circles [ index ] = value ;
241266 }
242267 }
243- //% group="List Middle "
268+ //% group="List Other "
244269 //% block="%myCircleList insert %value=variables_get(myCircle) at %index"
245270 insertCircleAt ( value :Circle , index :number ) {
246271 this . _circles . insertAt ( index , value )
247272 }
248- /*
249- end
250- */
251- //% group="List End"
252- //% block="%myCircleList remove and destroy last circle"
253- removeAndDestroyLast ( ) {
254- if ( this . length ( ) > 0 )
255- {
256- let tmp = this . _circles . removeAt ( this . length ( ) - 1 )
257- tmp . destroy ( )
258- }
259- }
260- //% group="List End"
261- //% block="get and remove last circle from %myCircleList"
262- getAndRemoveLast ( ) :Circle {
263- if ( this . length ( ) > 0 ) {
264- return this . _circles . removeAt ( this . length ( ) - 1 )
265- }
266- return null ;
267- }
268273
269- //% group="List End"
270- //% block="%myCircleList add %value=variables_get(myCircle) to end"
271- addCircleToEnd ( value :Circle ) {
272- this . _circles . push ( value )
273- }
274274}
275275
0 commit comments