View Single Post
djazz

JCF Member

Joined: Feb 2009

Posts: 257

djazz is OFF DA CHARTdjazz is OFF DA CHARTdjazz is OFF DA CHART

Oct 18, 2010, 11:13 PM
djazz is offline
Reply With Quote
Quote:
Originally Posted by Unknown Rabbit View Post
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 parallaxC.offsetWidth;
        var 
parallaxC.offsetHeight;
        var 
scrollX LayerDiv.scrollLeft;
        var 
scrollY LayerDiv.scrollTop;
        if(
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 
7>= 0l--) {
            for(var 
ii=Math.floor((scrollX*layerSpeed[l][0]+scrollXoffset)/32)*32ii <= 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+32ii+=32) {
                for(var 
jj=Math.floor((scrollY*layerSpeed[l][1]+scrollYoffset)/32)*32jj <= 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+32jj+=32) {

// Check for tiling layers etc...

// Using this drawing function
srcpos idXY(tileData[l][ii/32][jj/32] % 102410);
pcc.drawImage(tilesetImagesrcpos[0]*32srcpos[1]*323232ii-(scrollX*layerSpeed[l][0]+scrollXoffset), jj-(scrollY*layerSpeed[l][1]+scrollYoffset), 3232); 
It works, but it's not the same

Full source for parallax.js

Still, the wanted result is this:
http://jazzjackrabbit.net/DJ/LvlView/
__________________
WebJCS 2 (new and in progress)
WebJCS 1 (old but complete)
SGIP Simple Games in Progress list
Level Packer v2 - With a GUI!
PHP Tileset Compiler