/* Realistic rain 3.0, by PurpleJazz http://www.jazz2online.com/snippets/143/realistic-rain/ */ void onLevelLoad() { jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON] + 2]; //the rain "bubble" for (uint i = 0; i < anim.frameCount; ++i) { jjANIMFRAME@ frame = jjAnimFrames[anim + i]; jjPIXELMAP rain(1,32); for (uint y = 0; y < rain.height; ++y) { if (y <= 24) { rain[0,y] = 75; } else { rain[0,y] = 74; } } rain.save(frame); frame.hotSpotX = -frame.width/2; frame.hotSpotY = -frame.height; } } void onMain() { for (int i = 0; i < 1024; i++) { //loop through the global array jjParticles[1024] jjPARTICLE@ particle = jjParticles[i]; if (particle.type == PARTICLE::RAIN) { particle.xSpeed = 0; //make rain fall straight down particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed); //the rain speed accounts for differences in the player speed, and so won't appear to fall more slowly when the player is falling } } }