Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda