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

839
Views
Kaboom.js: cómo configurar el fondo de una imagen

Estoy creando un juego kaboom.js y quiero establecer el fondo de una escena en una imagen. Solo puedo encontrar soluciones para cambiar el fondo a un color. ¡Espero que alguien pueda ayudar!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En Kaboom.js no hay soporte especial para imágenes de fondo. Sin embargo, puede usar un objeto de juego normal con un componente de sprite como imagen de fondo. Aquí hay un ejemplo simple:

 async function init() { kaboom(); let bgImage = await loadSprite("background", "https://www.paulwheeler.us/files/windows-95-desktop-background.jpg"); let background = add([ sprite("background"), // Make the background centered on the screen pos(width() / 2, height() / 2), origin("center"), // Allow the background to be scaled scale(1), // Keep the background position fixed even when the camera moves fixed() ]); // Scale the background to cover the screen background.scaleTo(Math.max( width() / bgImage.tex.width, height() / bgImage.tex.height )); } init();
 <script src="https://cdn.jsdelivr.net/npm/kaboom@2000.1.8/dist/kaboom.js"></script>

about 4 years ago · Juan Pablo Isaza Report
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!