FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/1340.bas at master · smallbasic/smallbasic.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
smallbasic
/
smallbasic.github.io
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1340.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (50 loc) · 1.15 KB
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1340.bas
Copy path
File metadata and controls
53 lines (50 loc) · 1.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'
Rotating Stars Mouse Chaser.bas for SmallBASIC 0.12.0 2015-11-09 MGA/B+
'
code is based on code: mouse chaser by tsh73
'
for the Just Basic contest, November 2008, I am 7 years later
nPoints
=
20
dim
x
(
nPoints
),
y
(
nPoints
)
for
i
=
1
to
nPoints
x
(
i
) =
xmax
y
(
i
) =
ymax
'
set it offscreen
next
pen on
color
9
,
0
while
1
'
len(inkey)=0
cls
twist
+=.
05
mx
=
pen
(
4
):
my
=
pen
(
5
)
for
i
=
1
to
nPoints
if
i
=
1
then
'
first sees mouse
dx
=
mx
-
x
(
i
)
dy
=
my
-
y
(
i
)
v
=
4
else
'
others see previous
dx
=
x
(
i
-1
)-
x
(
i
)
dy
=
y
(
i
-1
)-
y
(
i
)
v
=
0.6
*
v
+
0.2
*
3
*(
2
-
i
/
nPoints
)
'
use 0.8 v of previous, to pick up speed
end if
r
=
sqr
(
dx
^
2
+
dy
^
2
)
dxN
=
dx
/
r
dyN
=
dy
/
r
x
(
i
) =
x
(
i
)+
v
*dxN
y
(
i
) =
y
(
i
)+
v
*dyN
drawstar
next
i
showpage
delay
10
wend
input
OK
sub
drawstar
()
local sp,
s
,
t
,
u
,
j
,
b
,
v
,
w
sp
=(
npoints
+
1
-
i
)*
2
+
3
'
star points when i is low, points are high
s
=
5
*(
50
^(
1
/
npoints
))^(
npoints
+
1
-
i
)
t
=
x
(
i
)+
s
*
cos
(
0
+
twist
)
u
=
y
(
i
)+
s
*
sin
(
0
+
twist
)
for
j
=
1
to
sp
b
+=
int
(
sp
/
2
)*
2
*
pi
/
sp
v
=
x
(
i
)+
s
*
cos
(
b
+
twist
)
w
=
y
(
i
)+
s
*
sin
(
b
+
twist
)
line t,
u
,
v
,
w
,
14
t
=
v
:
u
=
w
next
end
Back
|
FazBrowse Home
|
New Git URL