Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda