26 lines
911 B
Markdown
26 lines
911 B
Markdown
{{{
|
|
"planted": "11/20/2020",
|
|
"repotted": "1/4/2026",
|
|
"nobreak": "true"
|
|
}}}
|
|
|
|
* I may have gotten a little bit sidetracked from my original goal of a 'boids' simulation... but I think this turned out cooler than any boids I could've fit in a #tweetcart otherwise!
|
|
#pico8 #tweetjam
|
|
(source in replies)
|
|
|
|

|
|
|
|
<div class="code"><p>
|
|
cls(7)k=rnd
|
|
x={}y={}r={}for i=0,30do
|
|
x[i]=k(128)y[i]=k(128)r[i]=k()end
|
|
::_::
|
|
for i=1,#x do
|
|
for j=1,#x do
|
|
if(i!=j)a=x[i]-x[j]b=y[i]-y[j]d=atan2(a,b)l=(a*a+b*b)^.5r[i]+=d/l/8-(d-r[i])/l/12end
|
|
pset(x[i],y[i],i%8+8)x[i]+=cos(r[i])y[i]+=sin(r[i])x[i]%=128y[i]%=128end
|
|
goto _
|
|
</p></div>
|
|
|
|
* Boids are a way of simulating flocking birds using simple rules. The wikipedia page explains it well: [https://en.wikipedia.org/wiki/Boids](https://en.wikipedia.org/wiki/Boids)
|
|
(I like to think that they were originally just birds but the author had a heavy accent)
|