Math problem - spawning every ... seconds

wmgeichwmgeich Member, PRO Posts: 28
edited November -1 in Working with GS (Mac)
Hi guys,
I have a tapping game that has 10 levels, each 30 seconds long on a timer. To achieve progressive difficulty I have increased the rate of spawning, (ie. every .5 seconds, every .45 seconds, etc.), and increased the number able to be spawned for each level.

I think my math is wrong cuz when I reach 50 actors spawned at a rate of .55 seconds each the level won't complete. Level complete is when all actors are destroyed in time limit (30 secs).

In the next level the spawning rate is .50 and the number of actors is 55 spawned in 30 seconds.

The next level the spawning rate is .475 and the number of actors is 60 spawned in 30 seconds.

What equation should I be using to make sure all actors are able to be tapped in time? Also is there a buffer I should use in either the number of actors or spawning rate to make sure the player can complete a level?

Thanks,

Bill

Comments

  • rlehmrlehm Member Posts: 320
    Honestly, I'd not destroy, I'd recycle them.

    Example: on touch,

    Change attribute self.position.x to random 20,460
    Change attribute self.position.y to random 20,300

    Change attribute game.score to game.score+1

    This way you don't need but the 30 second timer. Each time they press and actor the actor instantly moves to a new location, but gives the appearance it was destroyed and renowned elsewhere. It also does not restrict your player and they can complete the level quickly.
  • rlehmrlehm Member Posts: 320
    Renowned should be respawned. Dang iPhone auto correct. Can't edit that far down either.. No was to scroll.
  • wmgeichwmgeich Member, PRO Posts: 28
    I tried recycling but I have 5 different actors that spawn in each level and it wasn't working. So in order to release my project in the deadline I went with spawning instead. The game works fine except for the problem I mentioned.

    Could someone help with my math?

    Bill
  • DrGlickertDrGlickert Member Posts: 1,135
    I don't know of an equation that will accomplish this task for you. Your numbers are inconsistent (.55, .5, .475, .45)...

    If they were simple number .5 each level you could try;

    (6 - (game.level*.5))*0.1

    That will give you a consistent set of time (level 1 = .55, level 5 = .25, etc).

    But since you have that .475 in their that throws things off. If you want to do that then I'd just edit each individual spawning actor in each level (in the scene editor) and put in the time that you want.
Sign In or Register to comment.