REM By Mr Kohlenstoff REM For the 2D-Physics-Competition REM Code finished 12.09.06 REM Particle-Simulation set display mode 800,600,32 set text font "Tahoma" set text size 14 type Particle Xpos as float ypos as float xmove as float ymove as float power as byte endtype global MinPower = 6 global MaxPower = 12 global SideMove = 4 global TopMove = 18 global Number = 2500 global MaxNumber = Number global StartNumber = MaxNumber/5 global ParticleGravity = 50 dim Particle(Number) as particle sync on : sync rate 30 hide mouse BoxSize = 8 `Größe der Particle-Boxen for p = 0 to Number Particle(p).xpos = rnd(screen width()) Particle(p).ypos = rnd(screen height()) Particle(p).xmove = 5-rnd(10) Particle(p).ymove = 5-rnd(15) Particle(p).power = MinPower + rnd(MaxPower - MinPower) next p ink rgb(32,255,64),0 Number = 200 do cls ink rgb(255,255,255),0 print "FPS: "+ str$(screen fps()) print "Particles: "+ str$(Number) print "Gravity: " + str$(ParticleGravity) print "Energy-Range: " + str$(MinPower) + "-" + str$(MaxPower) print "Side-Movement: " + str$(SideMove) print "Top-Movement: " + str$(TopMove) print "---" print "Press Shift- or Controlkey to change the gravity." print "Press '-' or '+' to change the Particle-Quantity." print "Press Rightkey and Leftkey to change the Side-Movement." print "Press Up- and Downkey to change the Top-Movement." print "Press 'r' to reset Particle-Positions." print "Press '.' or ',' to change the Energy-Range." print len(Console$) if inkey$()="-" then dec Number, 5 if inkey$()="+" then inc Number, 5 if inkey$()="." then inc MinPower : inc MaxPower if inkey$()="," then dec MinPower : dec MaxPower if Number < 0 then Number = 0 if Number > MaxNumber then Number = MaxNumber inc ParticleGravity, 5*(Shiftkey()-Controlkey()) inc SideMove, rightkey()-leftkey() inc TopMove, upkey()-downkey() if inkey$()="r" for p = 0 to Number Particle(p).xpos = mousex() Particle(p).ypos = mousey() Particle(p).xmove = SideMove - rnd(SideMove*200)/100.0 Particle(p).ymove = -rnd(TopMove*100)/100.0 Particle(p).power = MinPower + rnd(MaxPower - MinPower) next p endif line mousex()-5, mousey(), mousex()+5, mousey() line mousex(), mousey()-5, mousex(), mousey()+5 for p = 0 to Number inc Particle(p).ymove, ParticleGravity/100.0 inc Particle(p).ypos, Particle(p).ymove if Particle(p).xpos => screen width() or Particle(p).xpos <= 0 then Particle(p).xmove = -Particle(p).xmove inc Particle(p).xpos, Particle(p).xmove if Particle(p).ypos => screen height() then Particle(p).ymove = -Particle(p).ymove* (0.7+rnd(29)/100.0) : dec Particle(p).power if abs(Particle(p).power) <= 1 Particle(p).xpos = mousex() Particle(p).ypos = mousey() Particle(p).xmove = SideMove - rnd(SideMove*200)/100.0 Particle(p).ymove = -rnd(TopMove*100)/100.0 Particle(p).power = MinPower + rnd(MaxPower - MinPower) endif next p lock pixels for p = 0 to Number R = 200+rnd(55) G = rnd(R*0.8) B = rnd(G*0.6) ink rgb(R, G, B),0 box Particle(p).xpos, Particle(p).ypos, Particle(p).xpos+BoxSize, Particle(p).ypos+BoxSize next p unlock pixels sync loop