DIM sujeto(100,6)
DIM quieto(100)
REM id, x,y,vel,dir,salud,vida
REM 0=x
REM 1=y
REM 2=vel=1 a 4
REM 3=dir 0-360 0=arriba
REM 4vsalud 0=nousa 1=sano 2=convirus 3=mejorado
REM 5=vida
MUSIC 1 LOAD "Introstartfx.wav"
MUSIC 1 PLAY
zero:
maxx = SCREEN_WIDTH()
maxy = SCREEN_HEIGHT()
GRAPHICS
GRAPHICS CLEAR
FILL COLOR 0,0,0
FILL RECT 400,400 SIZE 800,1000
horas=0
SLIDER 0 VALUE 1 AT 700,120 vsize 400
SLIDER 0 SHOW
BUTTON "dibuja" title "dibuja" AT 680,40 SIZE 80,40
BUTTON "para" title "para" AT 680,540 SIZE 80,40
hold:
IF BUTTON_PRESSED("dibuja")=1 THEN
NOTES SET "13:a"
NOTES PLAY
GOTO parte
END IF
lim= INT((1-SLIDER_VALUE("0"))*100)
GOSUB stat
PAUSE 0.5
GOTO hold
parte:
GOSUB inicia
GOSUB dibuja
LOOP:
GOSUB mueve
GOSUB enferma
GOSUB borrar
GOSUB dibuja
REFRESH
IF statx=1 THEN GOSUB stat
IF BUTTON_PRESSED("para")=1 THEN
NOTES SET "3:e"
NOTES PLAY
GOTO zero
END IF
horas=horas+1
GOTO LOOP
borrar2:
FILL COLOR 0,0,0
FILL RECT 400,400 SIZE 200,200
RETURN
REM inicia datos
inicia:
sujeto(1,0)=200
sujeto(1,1)=200
sujeto(1,2)=2
sujeto(1,3)=RND(6.28)
sujeto(1,4)=2
sujeto(1,5)=1
REM los demas
FOR i=2 TO 99
sujeto(i,0)=RND(400)
sujeto(i,1)=RND(400)
sujeto(i,2)=1
sujeto(i,3)=RND(6.28)
sujeto(i,4)=1
sujeto(1,5)=1
NEXT i
REM sin mover
con=0
FOR i=2 TO 99
IF con<lim THEN
quieto(i)=1
con=con+1
END IF
NEXT i
RETURN
REM dibuja sujetos
dibuja:
FOR i=1 TO 99
IF sujeto(i,4)=1 THEN FILL COLOR 0,0,1
IF sujeto(i,4)=2 THEN FILL COLOR 1,0,0
IF sujeto(i,4)=3 THEN FILL COLOR 0,1,0
x=sujeto(i,0)
y=sujeto(i,1)
FILL RECT x+200,y+200 SIZE 2
NEXT i
REM pause 0.5
RETURN
REM borra sujetos
borrar:
FOR i=1 TO 99
REM if quieto(i)=1 then goto borrae
x=sujeto(i,0)
y=sujeto(i,1)
FILL COLOR 0,0,0
FILL RECT x+200,y+200 SIZE 4
NEXT i
borrae:
RETURN
mueve:
FOR i=1 TO 99
IF quieto(i)=1 THEN GOTO muevee
a=SIN(sujeto(i,3))
b=COS(sujeto(i,3))
sujeto(i,0)=sujeto(i,0)+(2*a)
sujeto(i,1)=sujeto(i,1)+(2*b)
x=sujeto(i,0)
y=sujeto(i,1)
a=sujeto(i,3)
REM definir para donde va
IF a<1.55 THEN
AT=1
GOTO mout
END IF
IF a<3.14 THEN
AT=2
GOTO mout
END IF
IF a<4.7 THEN
AT=3
GOTO mout
END IF
AT=4
mout:
REM pared derecha
IF x>390 AND AT=1 THEN
a=a+4.5+RND(0.2)
GOTO no
END IF
IF x>390 AND AT=2 THEN
a=a+1.55 +RND(0.2)
GOTO no
END IF
REM pared superior
IF y<10 AND AT=2 THEN
a=a-1.55 +RND(0.2)
GOTO no
END IF
IF y<10 AND AT=3 THEN
a=a+1.55 +RND(0.2)
GOTO no
END IF
REM pared izquierda
IF x<10 AND AT=3 THEN
a=a-1.55 +RND(0.2)
GOTO no
END IF
IF x<10 AND AT=4 THEN
a=a-4.71 +RND(0.2)
GOTO no
END IF
REM pared abajo
IF y> 390 AND AT=1 THEN
a=a+1.55 +RND(0.2)
GOTO no
END IF
IF y> 390 AND AT=4 THEN
a=a-3.28 +RND(0.2)
GOTO no
END IF
no:
x=x+0
y=y+0
GOSUB lados
sujeto(i,3)=a
muevee:
NEXT i
RETURN
lados:
FOR j=1 TO 99
IF j<>i THEN
xj=sujeto(j,0)
yj=sujeto(j,1)
IF ABS(x-xj)<6 AND ABS(y-yj)<6 THEN
a=a+1.55
IF a>6.28 THEN a=a-6.28
END IF
END IF
NEXT j
RETURN
enferma:
statx=0
FOR i=1 TO 99
IF sujeto(i,4)=2 THEN
sujeto(i,5)=sujeto(i,5)+1
IF sujeto(i,5)>500 THEN
sujeto(i,4)=3
statx=1
END IF
x=sujeto(i,0)
y=sujeto(i,1)
FOR j=1 TO 99
xj=sujeto(j,0)
yj=sujeto(j,1)
IF sujeto(i,4)=2 AND ABS(x-xj)<6 AND ABS(y-yj)<6 THEN sujeto(j,4)=2
statx=1
END IF
NEXT j
NEXT i
RETURN
stat:
sano=0
enfermo=0
mejorado=0
FOR i=1 TO 99
salud=sujeto(i,4)
IF salud=1 THEN sano=sano+1
IF salud=2 THEN enfermo=enfermo+1
IF salud=3 THEN mejorado=mejorado+1
NEXT i
FILL COLOR 0,0,0
FILL RECT 380,680 SIZE 100,50
p$=horas
DRAW COLOR 1,1,1
DRAW TEXT "horas" AT 300,630
DRAW TEXT p$ AT 420,630
p$=sano
DRAW COLOR 0,0,1
DRAW TEXT "sanos" AT 300,650
DRAW TEXT p$ AT 420,650
p$=enfermo
DRAW COLOR 1,0,0
DRAW TEXT "enfermos" AT 300,670
DRAW TEXT p$ AT 420,670
DRAW COLOR 0,1,0
DRAW TEXT "mejorados" AT 300,690
p$=mejorado
DRAW TEXT p$ AT 420,690
DRAW COLOR 1,1,1
DRAW TEXT "quietos" AT 300,710
p$=lim
DRAW TEXT p$ AT 420,710
RETURN
CORONAVIRUS SIMULATOR
-
- Posts: 2
- Joined: Tue Mar 31, 2020 12:03 pm
- My devices: Iphone 7, Iphone SE, Ipad 2, Ipad 6th
- Flag:
CORONAVIRUS SIMULATOR
- Attachments
-
- virus quietos.txt
- (3.72 KiB) Downloaded 397 times
-
- Introstartfx.wav
- (2.34 MiB) Downloaded 375 times
Last edited by jaimemv on Tue Mar 31, 2020 1:13 pm, edited 1 time in total.
-
- Posts: 2
- Joined: Tue Mar 31, 2020 12:03 pm
- My devices: Iphone 7, Iphone SE, Ipad 2, Ipad 6th
- Flag:
Re: CORONAVIRUS SIMULATOR
Videos demo.
- Attachments
-
- coronavirus demo 1.mp4
- (4.84 MiB) Downloaded 444 times
-
- coronavirus demo 2.mp4
- (1.6 MiB) Downloaded 380 times
-
- coronavirus demo 3.mp4
- (6.65 MiB) Downloaded 404 times