Particle fountain: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 1,309: | Line 1,309: | ||
var Game = ParticleDisplay.new(3000, 800, 800)</syntaxhighlight> |
var Game = ParticleDisplay.new(3000, 800, 800)</syntaxhighlight> |
||
=={{header|XPL0}}== |
|||
{{trans|EasyLang}} |
|||
[[File:XPL0_Fountain.gif|right]] |
|||
<syntaxhighlight lang "XPL0">func real RandomF; |
|||
return float(Ran(1000)) / 1000.; |
|||
def N = 6000; |
|||
real X(N), Y(N); |
|||
real VX(N), VY(N); |
|||
def Color = 15; |
|||
int I, Ind; |
|||
[SetVid($12); |
|||
Ind:= 0; |
|||
repeat |
|||
for I:= 1 to 32 do |
|||
[Ind:= rem((Ind+1)/N); |
|||
X(Ind):= 50. + RandomF; |
|||
Y(Ind):= float(I)/4.; |
|||
VX(Ind):= (RandomF - 0.5) * 0.4; |
|||
VY(Ind):= 2. + RandomF*0.1; |
|||
]; |
|||
WaitForVSync; |
|||
Clear; |
|||
for I:= 0 to N-1 do |
|||
[Point(fix(X(I)), 480-fix(Y(I)), Color); |
|||
X(I):= X(I) + VX(I); Y(I):= Y(I) + VY(I); |
|||
VY(I):= VY(I) - 0.025; |
|||
]; |
|||
until KeyHit; |
|||
]</syntaxhighlight> |