Quote: "You might could get away with using a particle system instead of sprites."
Or use a shader like this except vertical scrolling instead of horizontal
SetErrorMode(2)
// set window properties
SetWindowTitle( "paralax Blocks" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
createShaderFile()
CreateSprite(1,0)
SetSpriteSize(1,1024,768)
LoadSpriteShader(2, "paralaxblocks.ps")
SetSpriteShader( 1,2 )
SetShaderConstantByName(2,"resolution",1024,768,0,0)
do
//SetShaderConstantByName(2,"resolution",GetPointerX()*2,768,0,0)
SetShaderConstantByName(2,"time",timer()*.25,0,0,0)
Print( ScreenFPS() )
Sync()
loop
function createShaderFile()
fw=OpenToWrite("paralaxblocks.ps")
WriteLine(fw,"#ifdef GL_ES")
WriteLine(fw,"precision mediump float;")
WriteLine(fw,"#endif")
WriteLine(fw,"uniform float time;")
WriteLine(fw,"uniform vec2 resolution;")
WriteLine(fw,"float nrand (vec2 co)")
WriteLine(fw,"{ ")
WriteLine(fw," float a = fract(cos(co.x * 8.3e-3 + co.y) * 4.7e5);")
WriteLine(fw," float b = fract(sin(co.x * 0.3e-3 + co.y) * 1.0e5);")
WriteLine(fw," return a * .5 + b * .5;")
WriteLine(fw,"}")
WriteLine(fw,"float genstars (float starsize, float density, float intensity, vec2 seed)")
WriteLine(fw,"{")
WriteLine(fw," float rnd = nrand(floor(seed * starsize));")
WriteLine(fw," float stars = pow(rnd,density) * intensity;")
WriteLine(fw," return stars;")
WriteLine(fw,"}")
WriteLine(fw,"vec3 Blue = vec3(0,0,1);")
WriteLine(fw,"void main (void)")
WriteLine(fw,"{")
WriteLine(fw," float r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4;")
WriteLine(fw," r1=abs(sin(time*1.0));")
WriteLine(fw," g1=abs(sin(time*1.7));")
WriteLine(fw," b1=abs(sin(time*2.3));")
WriteLine(fw," r2=abs(sin(time*2.0));")
WriteLine(fw," g2=abs(sin(time*1.5));")
WriteLine(fw," b2=abs(sin(time*1.7));")
WriteLine(fw," r3=abs(sin(time*3.0));")
WriteLine(fw," g3=abs(sin(time*2.7));")
WriteLine(fw," b3=abs(sin(time*1.5));")
WriteLine(fw," r4=abs(sin(time*3.1));")
WriteLine(fw," g4=abs(sin(time*1.3));")
WriteLine(fw," b4=abs(sin(time*1.6));")
WriteLine(fw," vec2 offset = vec2(time * 8.25,0);")
WriteLine(fw," vec2 p = 2.0 * (gl_FragCoord.xy / resolution) - 1.0;")
WriteLine(fw," p.x *= resolution.x / resolution.y;")
WriteLine(fw," p *= 350.0;")
WriteLine(fw," float intensity1 = genstars(0.025, 16.0, 2.5, p + offset * 40.);")
WriteLine(fw," float intensity2 = genstars(0.05, 16.0, 1.5, p + offset * 20.);")
WriteLine(fw," float intensity3 = genstars(0.10, 16.0, 1.0, p + offset * 10.);")
WriteLine(fw," float intensity4 = genstars(0.015, 16.0, 3.0, p + offset * 60.);")
WriteLine(fw," gl_FragColor = vec4(intensity1 *vec3(r1,g1,b1)+intensity2 *vec3(r2,g2,b2)+intensity3 *vec3(r3,g3,b3)+intensity4 *vec3(r4,g4,b4), 1);")
WriteLine(fw,"}")
CloseFile(fw)
endfunction
It could be done so that you use it as your background and if theres a color black at the uvlocation of the texture don't draw the current back ground one
which would give depth
One of the shader experts may be able to help lol not me they still blow my mind lol
Should then be able to have thousands
fubar