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

202
Views
¿Cómo generar diferentes puntos de generación para objetos (Javascript)?

Tengo problemas para crear diferentes puntos de generación para cada objeto, como se muestra a continuación. Tengo 4 puntos de generación configurados, sin embargo, todos los objetos se generan desde i = 0. ¡Cualquier comentario sería genial!

Gracias,

 var spawnX = 0; var spawnY = 0; function getSpawnX(i){ if(i=0 || 4 || 8 || 12 || 16 || 20 || 24 || 28){ spawnX = width/4 return spawnX; }else{ spawnX = width/2 return spawnX; } } function getSpawnY(i){ if(i=0 || 4 || 8 || 12 || 16 || 20 || 24 || 28){ spawnY = height/4 return spawnY; }else{ spawnY = width*(3/4) return spawnY; } } for (let i = 0; i < numParticles; i++) { //creates array of objects for each rect p[i] = particle.create( //spawn points getSpawnX(i), //x starting x point getSpawnY(i), //y starting y point Math.random() * 45 + 45 , // random w (minimum 45, max 90) Math.random() * 45 + 45 , // random h (minimum 45, max 90) Math.random() * 15 * randomSign(), //random dx Math.random() * 15 * randomSign() //random dy ) }
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!