Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
problems moving a game sprite angle

I have a game sprite that I want to move verticaly, and normally this would be easy with this.x += number, exept for the fact that the x/y of the sprite are relitive to its angle. this can be kinda confusing so I have a example here. enter image description here

in other cases where the picture will not load of something else i have a link examplepicture

it can get kinda long do here is the basic code

this.update = function() {
        ctx = myGameArea.context;
      if (type == "image") {
          
          
ctx.save();
       ctx.translate(300, 200);
        ctx.rotate(this.angle);
        ctx.translate(this.x, this.y)
       
            ctx.drawImage(this.image, 
                this.width / -2, 
                this.height/ -2,
                this.width, this.height);
ctx.restore(); 
        
        
            }else {
        ctx.save();
        ctx.translate(this.x, this.y);
        ctx.rotate(this.angle);
        ctx.fillStyle = color;
        ctx.fillRect(this.width / -2, this.height / -2, this.width, this.height);
        
        ctx.restore();
        
      }
    }



function framethingupdate() {
gamething.update();
}

due to certen issues i am unable to run or provide a demo, however if the full code is needed you can find it her: full code

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!