View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,993

Violet CLM has disabled reputation

May 23, 2015, 03:06 PM
Violet CLM is offline
Reply With Quote
Code:
void onPlayer(jjPLAYER@ play) {
	jjPARTICLE@ part = jjAddParticle(PARTICLE::ICETRAIL);
	if (part !is null) {
		part.xPos = play.cameraX + (jjRandom() % jjSubscreenWidth);
		part.yPos = play.cameraY;
	}
}
You may want to use some more sophisticated approach than jjRandom, or a frequency different than one particle per tick (regardless of screen width), but the important thing is that jjPLAYER::cameraX and jjPLAYER::cameraY are used for translating between level coordinates and screen coordinates.

If you end up deciding against PARTICLE::ICETRAIL, though, you could also create your own tiny particle class containing position, (maybe) color and (maybe) lifetime values, make an array of that class, and draw blue pixels (or small rectangles or something) directly to a non-layer jjCANVAS based on the array's contents' positions. But ICETRAIL is simpler if you don't want to figure out classes.
__________________