Created
January 9, 2017 17:24
-
-
Save sealgair/d2fb7b02bb8673e9ba4a46386dec62df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- randomly choose item from table | |
function rndchoice(t) | |
return t[flr(rnd(#t))+1] | |
end | |
stars = {} | |
function makestars(n) | |
colors={1,5,6,7,13} | |
for i=1,n do | |
add(stars, { | |
x=flr(rnd(128)), | |
y=flr(rnd(128)), | |
c=rndchoice(colors) | |
}) | |
end | |
end | |
function _draw() | |
for s in all(stars) do | |
if rnd()>0.02 then | |
pset(s.x, s.y, s.c) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment