• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

133
Views
problemas para mover un ángulo de sprite del juego

Tengo un sprite de juego que quiero mover verticalmente, y normalmente esto sería fácil con this.x += number , excepto por el hecho de que las x/y del sprite son relativas a su ángulo. esto puede ser un poco confuso, así que tengo un ejemplo aquí. ingrese la descripción de la imagen aquí

en otros casos, donde la imagen no se cargará de otra cosa, tengo un enlace de imagen de ejemplo

puede ser un poco largo aquí está el código básico

 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(); }

debido a ciertos problemas, no puedo ejecutar o proporcionar una demostración, sin embargo, si se necesita el código completo, puede encontrarlo aquí: código completo

about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error