is there a formula to know how many enemies i can place before jumping character?

| | August 4, 2015

My game is very similar to the hidden game in chromes web browser. I have a character that needs to jump over incoming enemies. Is there any way i can know when to send an incoming enemy? Some of the factors to take in to account i guess are the speed of enemies, height of jump, speed of jump, and dimensions of bitmaps (that represent character, and enemies).

Thanks

One Response to “is there a formula to know how many enemies i can place before jumping character?”

  1. Something as simple as this would give you the rough time the player will have to react if you were to spawn an enemy right now.

    minReactionTime = 0.5; //Give the player half a second to react
    closingSpeed = enemySpeed + playerSpeed;
    
    if ( (enemySpawn - playerPosition) / closingSpeed >= minReactionTime )
    {
       spawnEnemy();
    }
    

Leave a Reply