Quote:
Originally Posted by Unknown Rabbit
Oh, sorry, I meant for displaying relative to the window, not storing. They're definitely multiples of 65536.
|
Oh, that, ah, well, no
I'm using this code for WebJCS (JavaScript):
PHP Code:
var w = parallaxC.offsetWidth; var h = parallaxC.offsetHeight; var scrollX = LayerDiv.scrollLeft; var scrollY = LayerDiv.scrollTop; if(h < 5) return; var scrollXoffset = Math.round((LayerDiv.offsetWidth)/2-w/2); var scrollYoffset = Math.round((LayerDiv.offsetHeight)/2-h/2); var drawn = 0; var srcpos=null; for(var l = 7; l >= 0; l--) { for(var ii=Math.floor((scrollX*layerSpeed[l][0]+scrollXoffset)/32)*32; ii <= Math.ceil((scrollX*layerSpeed[l][0]+scrollXoffset)/32)*32-(scrollX*layerSpeed[l][0]+scrollXoffset)+Math.floor((w)/32)*32+Math.floor((scrollX*layerSpeed[l][0]+scrollXoffset)/32)*32+32; ii+=32) { for(var jj=Math.floor((scrollY*layerSpeed[l][1]+scrollYoffset)/32)*32; jj <= Math.ceil((scrollY*layerSpeed[l][1]+scrollYoffset)/32)*32-(scrollY*layerSpeed[l][1]+scrollYoffset)+Math.floor((h)/32)*32+Math.floor((scrollY*layerSpeed[l][1]+scrollYoffset)/32)*32+32; jj+=32) {
// Check for tiling layers etc...
// Using this drawing function srcpos = idXY(tileData[l][ii/32][jj/32] % 1024, 10); pcc.drawImage(tilesetImage, srcpos[0]*32, srcpos[1]*32, 32, 32, ii-(scrollX*layerSpeed[l][0]+scrollXoffset), jj-(scrollY*layerSpeed[l][1]+scrollYoffset), 32, 32);
It works, but it's not the same
Full source for parallax.js
Still, the wanted result is this:
http://jazzjackrabbit.net/DJ/LvlView/
|