FIX: SpaceInvaders: accumulated slowdown (when speeding up)
This commit is contained in:
parent
5dbfdbb129
commit
4030b9136a
@ -89,7 +89,7 @@ public:
|
|||||||
void stepRockets(microseconds_t dt) {
|
void stepRockets(microseconds_t dt) {
|
||||||
rocketRuntime += dt;
|
rocketRuntime += dt;
|
||||||
if (rocketRuntime > 200000) {
|
if (rocketRuntime > 200000) {
|
||||||
rocketRuntime -= 200000;
|
rocketRuntime = rocketRuntime % 200000;
|
||||||
for (Rocket *rocket = rocketsBegin; rocket < rocketsEnd; rocket++) {
|
for (Rocket *rocket = rocketsBegin; rocket < rocketsEnd; rocket++) {
|
||||||
if (rocket->alive) {
|
if (rocket->alive) {
|
||||||
if (rocket->y == 0) {
|
if (rocket->y == 0) {
|
||||||
@ -117,7 +117,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (swarmRuntime >= 1000000) {
|
if (swarmRuntime >= 1000000) {
|
||||||
swarmRuntime -= 1000000;
|
swarmRuntime = swarmRuntime % 1000000;
|
||||||
if (swarmLeft) {
|
if (swarmLeft) {
|
||||||
swarmX--;
|
swarmX--;
|
||||||
if (swarmX == 0) {
|
if (swarmX == 0) {
|
||||||
@ -138,7 +138,7 @@ public:
|
|||||||
void stepHero(microseconds_t dt) {
|
void stepHero(microseconds_t dt) {
|
||||||
heroRuntime += dt;
|
heroRuntime += dt;
|
||||||
if (heroRuntime >= 50000) {
|
if (heroRuntime >= 50000) {
|
||||||
heroRuntime -= 50000;
|
heroRuntime = heroRuntime % 50000;
|
||||||
if (heroLeft) {
|
if (heroLeft) {
|
||||||
heroX--;
|
heroX--;
|
||||||
if (heroX <= 1 || randomBool(20)) {
|
if (heroX <= 1 || randomBool(20)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user