Jump to content
  • Advertisement
Sign in to follow this  
Infinity8378

Zooming between ImageViews using Parallax Scrolling

This topic is 650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

problematic code
function BB(e){
switch(locA) {
    case 0:
         GBV=SQQ*RESX;
         GBC=480-(480/SQQ);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ), 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+1*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+2*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+3*GBV, 513,GBV,SQQ*RESY);
 
    break;
    case 1:
        GBP=2*RESX+(4*step);
         GBA=(2*(FQ-step))+240;
        ctx.drawImage(IMAGEB, 0,0,1024,480,3*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,2*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,1*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,GBA, 513,GBP,RESY+(2*step));
    break;
    case 2:
         GBV=SQQ*RESX;
         GBC=480-(480/SQQ);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ), 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+1*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+2*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+3*GBV, 513,GBV,SQQ*RESY);
    break;
    case 3:
        GBP=2*RESX+(4*step);
         GBA=(2*(FQ-step))+240;
        ctx.drawImage(IMAGEB, 0,0,1024,480,3*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,2*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,1*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,GBA, 513,GBP,RESY+(2*step));
    break;
    case 4:
         GBV=SQQ*RESX;
         GBC=480-(480/SQQ);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ), 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+1*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+2*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+3*GBV, 513,GBV,SQQ*RESY);
 
    break;
    case 5:
        GBP=2*RESX+(4*step);
         GBA=(2*(FQ-step))+240;
        ctx.drawImage(IMAGEB, 0,0,1024,480,3*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,2*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,1*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,GBA, 513,GBP,RESY+(2*step));
    break;
    case 6:
         GBV=SQQ*RESX;
         GBC=480-(480/SQQ);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ), 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+1*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+2*GBV, 513,GBV,SQQ*RESY);
        ctx.drawImage(IMAGEA, 0,GBC,512,480,(FQ)+3*GBV, 513,GBV,SQQ*RESY);
    break;
    case 7:
        GBP=2*RESX+(4*step);
        GBA=(2*(FQ-step))+240;
        ctx.drawImage(IMAGEB, 0,0,1024,480,3*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,2*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,1*GBP+GBA, 513,GBP,RESY+(2*step));
        ctx.drawImage(IMAGEB, 0,0,1024,480,GBA, 513,GBP,RESY+(2*step));
    break;
        default:
}
}
var Qval=e.keyCode;
switch (Qval) {
         case 39:
               if((locA%2)==1){
               FQ=-1*((-1*FQ)%((6*(RESX+(2*step)))));
               }else{
               FQ=-1*((-1*FQ)%(3*(RESX*SQQ)));
               }
               FQ--;
            break;
        case 87:
               //up
            if((locA%2)==1){
            if((step>99)){
            locA=(locA+1)%8;
            step=0;
            }else{
            step++;
            FQ-=FQ/512
            }
            }else{
            if((SQQ>2)){
            locA=(locA+1)%8;
            SQQ=1;
            }else{
            SQQ=SQQ+0.04;
            FQ-=(RESX*SQQ*0.02)
            }
            }
            break;
        case 37:
               if (FQ<0){
               FQ++;
               }else{
               FQ--;
               }
            break;
        case 83:
              //down
            if((locA%2)==1){
            if((step<1)){
            
            locA=(locA+7)%8;
            step=99;
            }else{
            step--;
            FQ+=FQ/512
            }
            }else{
            if((SQQ<1)){
            locA=(locA+7)%8;
            SQQ=2;
            }else{
            SQQ=SQQ-0.04;
            FQ+=(RESX*SQQ*0.02)
            }
            }
            break;
       default:
    }

}

Edited by Infinity8378

Share this post


Link to post
Share on other sites
Advertisement

We are not here to debug random code you've found somewhere that doesn't do what you want.

Share this post


Link to post
Share on other sites

This topic is 650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!