這幾天看Lua,寫了個測試程式,記得以前剛開始學windows GDI 的時候,最喜歡寫一堆字母在視窗裡飛來飛去的效果,還寫個螢幕保護程式版。配上 Lua 之後,每一個新的效果只要寫寫幾行 script 就搞定啦!
function OnLaunched()
local c = 512;
local x = 0;
local y = 0;
while (c > 0) do
x = math.random(0, 800);
y = math.random(0, 600);
AddNewParticle(math.random(65, 90));
SetNewParticleColor(
256 * math.random(0, 255),
0x00000200);
SetNewParticlePosition(x, y);
SetNewParticleVecl(0, math.random(1, 4));
SetNewParticleAccel(0, math.random(1, 4));
DeliverParticle();
c = c - 1;
end
end
function OnLButtonUp(x, y)
end
function OnParticleKilled(c)
local x = 0;
local y = 0;
while (c > 0) do
x = math.random(0, 800);
y = math.random(0, 600);
AddNewParticle(math.random(65, 90));
SetNewParticleColor(
256 * math.random(0, 255),
0x00000200);
SetNewParticlePosition(x, y);
SetNewParticleVecl(0, math.random(1, 4));
SetNewParticleAccel(0, math.random(1, 4));
DeliverParticle();
c = c - 1;
end
end
沒力了。
May 18, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment