Worms
A simple demo.
/////////////////////////////////////////////////////////////////////////////////// BEGIN object DEMOWORMS /////////////////////////////////////////////////////////////////////////////////// OBJECT Scripta = @ DEMO_worms OBJECT Parent = APPLET END /////////////////////////////////////////////////////////////////////////////////// branch init() /////////////////////////////////////////////////////////////////////////////////// @.init() INTEGER $.particles = 20000 INTEGERS $.particleC = repeat(0, particles) INTEGERS $.particleX = rand(0, 640, particles) INTEGERS $.particleY = rand(0, 480, particles) INTEGERS $.dX = rand(-1, 1, particles) INTEGERS $.dY = rand(-1, 1, particles) INTEGERS $.dTest = or(dX, dY) dTest = dTest == 0 [dX[dTest]] = {-1 0 1 0} [dY[dTest]] = { 0 1 0 -1} INTEGER $.clearer = 0 INTEGER i = 1 INTEGER r INTEGER g INTEGER b while i <= particles r = rand(0, 205) g = rand(0, 205) b = rand(48, 255) particleC[i] = rendColor(r, g, b) i += 1 endwhile end /////////////////////////////////////////////////////////////////////////////////// branch update() /////////////////////////////////////////////////////////////////////////////////// particleX += dX particleY += dY INTEGERS rx = rand(1, particles, 500) INTEGERS ry = rand(1, particles, 500) [dX[rx]] = dX[rx] * -1 [dY[ry]] = dY[ry] * -1 end /////////////////////////////////////////////////////////////////////////////////// branch render() /////////////////////////////////////////////////////////////////////////////////// rendSetColor(rendColor(255, 245, 244)) rendSetBlending('mul') rendFill(0, clearer, 640, clearer + 180) rendSetBlending() if (clearer += 1) > 600 clearer = -400 endif rendParticleSelect(5, {0, 0, 0, -1, -1, 0, 0, 1, 1, 0}) rendParticles(particles, particleX, particleY, particleC) end
