SCREEN_WIDTH = 240 SCREEN_HEIGHT = 320 resize_pixi(0, SCREEN_WIDTH, SCREEN_HEIGHT) cabins_num = 10 angle = 0 radius = 100 Y=#00FF80 t=#80FFFF cabin_img = " .......00000........ ......00YYY00....... .....00YYYYY00...... .....00YYYYY00...... ......00YYY00....... .......00000........ ......0000000....... ......00...00....... .....00.....00...... .....00.....00...... ....00.......00..... ....00.......00..... ...00.........00.... .000000000000000000. 00000000000000000000 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00ttttttt00ttttttt00 00000000000000000000 00YYYYYYY00YYYYYYY00 00YYY00YY00YY00YYY00 00YYY00YY00YY00YYY00 00YYYYYYY00YYYYYYY00 00YYYYYYY00YYYYYYY00 00000000000000000000 .000000000000000000. " make_pixi(cabin_img) wheel_img = new_pixi(SCREEN_WIDTH, SCREEN_HEIGHT, 1) COLOR = BLUE FALL_SPEED = 2 ROT_SPEED = 1 W_THICK = 4 X=0 Y=1 FALL=2 SIZE=3 cabins = new_array(cabins_num*SIZE) n = 0 while(n < cabins_num){ cabins[n*SIZE+FALL] = 0 n+1 } // calculate wheel x = 0 while(x < SCREEN_WIDTH){ y = 0 while(y < SCREEN_HEIGHT){ L = (x-SCREEN_WIDTH/2)*(x-SCREEN_WIDTH/2) + (y-SCREEN_HEIGHT/2)*(y-SCREEN_HEIGHT/2) sqrt if (radius-W_THICK/2 < rslt) & (rslt < radius+W_THICK/2) { col = COLOR } else { col = SNEG } wheel_img[y*SCREEN_WIDTH+x] = col y+1 } x+1 } while(1){ clear(SNEG) // draw wheel pixi(wheel_img, 0, 0) // draw cabins n = 0 while(n < cabins_num){ if cabins[n*SIZE+FALL] = 0 { cabins[n*SIZE+X] = cos(n*512/cabins_num+angle)*radius/256 cabins[n*SIZE+Y] = sin(n*512/cabins_num+angle)*radius/256+get_pixi_ysize(cabin_img)/2-2 } else { cabins[n*SIZE+Y] = cabins[n*SIZE+Y]+FALL_SPEED } pixi(cabin_img, cabins[n*SIZE+X], cabins[n*SIZE+Y]) n+1 } // check user clicked handle_pen_keys({ n = cabins_num-1 while(n >= 0){ if gpr(-get_pixi_xsize(cabin_img)/2+cabins[n*SIZE+X], -get_pixi_ysize(cabin_img)/2+cabins[n*SIZE+Y], get_pixi_xsize(cabin_img), get_pixi_ysize(cabin_img)){ cabins[n*SIZE+FALL] = 1 n = -1 // break } n-1 } }, {}, {}) // draw text print("Click on the cabins", -SCREEN_WIDTH/2+5, -SCREEN_HEIGHT/2+5, #808080) angle+ROT_SPEED frame(50) } sqrt: rslt = L div = L if L <= 0 { ret } while (1){ div = (L / div + div) / 2 if rslt > div { rslt = div } else { ret } } ret
