REM *********TROUBLED CLOCK***************
REM *** tap screen to exit ******
REM *** ©RWS ***
AAA: SET TOOLBAR OFF
sw=SCREEN_WIDTH()
sh=SCREEN_HEIGHT()
DIM months$(13)
DIM days$(8)
DATA "jan","feb","mrt","apr","may","jun","jul","aug","sep","oct","nov","dec"
DATA " sunday"," monday","tuesday","wednesday","thursday"," friday","saturday"
RESTORE
FOR i =0 TO 11
READ months$(i)
NEXT i
FOR i= 0 TO 6
READ days$(i)
NEXT i
OPTION ANGLE DEGREES
OPTION SPRITE POS CENTRAL
ON=1
OFF=0
year=CURRENT_YEAR()
month$=months$(CURRENT_MONTH()-1)
date=CURRENT_DATE()
day$=days$(CURRENT_DAY())
datetext$=STR$(date)&"-"&month$&"-"&STR$(year)
hr=CURRENT_HOUR()
MIN=CURRENT_MINUTE()
sec=CURRENT_SECOND()
hr_angle=((hr%12)*3600+MIN*60+sec)/120
min_angle=(MIN*60+sec)/10
sec_angle=sec*6
centreX=sw/2
centreY=sh/2
dt=.02
xmove=0
ymove=0
TIME RESET
nxttime=5
GRAPHICS
DRAW COLOR 1,1,1
rad=100
sec=15
MIN=16
hrs=17
DIM moving(18)
FOR i=1 TO 12
SPRITE i BEGIN rad/2,rad/2
DRAW FONT SIZE 20
DRAW TEXT STR$(i) AT rad/4,rad/4
SPRITE END
NEXT i
SPRITE 13 BEGIN 200,50
DRAW FONT SIZE 15
DRAW TEXT day$ AT 60, 25
SPRITE END
SPRITE 14 BEGIN 200,50
DRAW FONT SIZE 15
DRAW TEXT datetext$ AT 55, 15
DRAW FONT SIZE 8
DRAW TEXT "© RWS" AT 86,40
SPRITE END
SPRITE 15 BEGIN 1.9*rad,1.9*rad
DRAW SIZE 1
DRAW LINE .95*rad,.95*rad TO 95,0
DRAW CIRCLE .95*rad,.95*rad SIZE 5
FILL CIRCLE .95*rad,.95*rad SIZE 5
SPRITE END
SPRITE 16 BEGIN 1.60*rad,1.60*rad
DRAW SIZE 2
DRAW LINE .80*rad,.80*rad TO .80*rad,0
SPRITE END
SPRITE 17 BEGIN 1.00*rad,1.00*rad
DRAW SIZE 3
DRAW LINE .50*rad,.50*rad TO .50*rad,0
SPRITE END
FOR i=1 TO 12
SPRITE i AT centreX+SIN(30*i-1)*rad,centreY-COS(30*i-1)*rad
SPRITE i DX xmove DY ymove
NEXT i
SPRITE 13 AT centreX+10,centreY-30
SPRITE 14 AT centreX+10,centreY+50
SPRITE 15 AT centreX+10,centreY+15 ANGLE sec_angle
SPRITE 15 DA 6*dt DX xmove DY ymove
SPRITE 16 AT centreX+10,centreY+15 ANGLE min_angle
SPRITE 16 DA .1*dt DX xmove DY ymove
SPRITE 17 AT centreX+10,centreY+15 ANGLE hr_angle
SPRITE 17 DA 1/120*dt DX xmove DY ymove
FOR i=1 TO 17
SPRITE i SHOW
SPRITE i DELAY dt
SPRITE i LOOP
NEXT i
DRAW FONT SIZE 20
DRAW TEXT "to exit: tap screen" AT sw-250,10
TIME RESET
nxttime=2
BBB: now=TIME()
IF moving(0)=OFF AND now>nxttime THEN
x1=.05*sw+RND(sw*.9)
y1=.05*sh+RND(sh*.9)
nxttime=1+RND(1)*3
TIME RESET
ddx=x1-centreX
ddy=y1-centreY
dist=SQRT(ddx^2+ddy^2)
spfactor=1000/dist
xmove=ddx/100*spfactor
ymove=ddy/100*spfactor
centreX=x1
centreY=y1
GOSUB MOVE
ELSE
GOSUB move
END IF
IF TOUCH_X(0)>0 THEN EXIT
GOTO BBB
MOVE :
moving(0)=OFF
FOR i=1 TO 12
t=TIME()
IF t<(i-1)*.1 THEN BREAK
GET SPRITE i POS px,py
IF ((px-centreX-SIN(30*i-1)*rad)^2+(py-centreY+COS(30*i-1)*rad)^2)<1000 THEN
SPRITE i DX 0 DY 0
moving(i)=OFF
ELSE
SPRITE i DX xmove DY ymove
moving(i)=ON
END IF
GOSUB outofbounds
NEXT i
IF t>(13-1)*.1 THEN
GET SPRITE 13 POS px,py
IF ((px-centreX-10)^2+(py-centreY+30)^2)<1000 THEN
SPRITE 13 DX 0 DY 0
moving(i)=OFF
ELSE
SPRITE 13 DX xmove DY ymove
moving(i)=ON
END IF
GOSUB outofbounds
END IF
IF t>(14-1)*.1 THEN
GET SPRITE 14 POS px,py
IF ((px-centreX-10)^2+(py-centreY-50)^2)<1000 THEN
SPRITE 14 DX 0 DY 0
moving(i)=OFF
ELSE
SPRITE 14 DX xmove DY ymove
moving(i)=ON
END IF
GOSUB outofbounds
END IF
FOR i=15 TO 17
GET SPRITE i POS px,py
IF ((px-centreX-10)^2+(py-centreY-15)^2)<1000 THEN
SPRITE i DX 0 DY 0
moving(i)=OFF
ELSE
SPRITE i DX xmove DY ymove
moving(i)=ON
END IF
GOSUB outofbounds
NEXT i
moving(0)=OFF
FOR i=1 TO 17
IF moving(i)=ON THEN
moving(0)=ON
BREAK i
END IF
NEXT i
IF moving(0)=ON THEN GOTO move
RETURN 'move
outofbounds:
IF px<-200 OR px>sw+200 OR py<-200 OR py>sh+200 THEN
SAY RATE .9
SAY VOICE "en-GB"
SAY TEXT "oops,, out off bounds"
GOTO AAA
END IF
RETURN
My Troubled Clock
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: My Troubled Clock
That's fun!