fix(examples): restart ball ids when the scene is cleared
World_Reset kept counting, so after one reset the ball dropped from 60 m was ball 10, not the ball 5 the plain build's output and the log from before the reset name. The agent in the first check noticed and worked around it. Clear now restarts ids at 1, so Reset brings back balls 1 to 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8e7f8c5f3b
commit
02f4564442
2 changed files with 3 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ void Basic::World::Reset() {
|
||||||
|
|
||||||
void Basic::World::Clear() {
|
void Basic::World::Clear() {
|
||||||
balls.clear();
|
balls.clear();
|
||||||
|
nextId = 1;
|
||||||
time = 0;
|
time = 0;
|
||||||
fastest = 0;
|
fastest = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,9 @@ export namespace Basic {
|
||||||
Physics physics;
|
Physics physics;
|
||||||
Floor floor;
|
Floor floor;
|
||||||
|
|
||||||
// Removes every ball and drops the scene's five.
|
// Removes every ball and drops the scene's five, as balls 1 to 5.
|
||||||
void Reset();
|
void Reset();
|
||||||
|
// Removes every ball; ids start again from 1.
|
||||||
void Clear();
|
void Clear();
|
||||||
// Returns the new ball's id.
|
// Returns the new ball's id.
|
||||||
std::int32_t Spawn(float x, float y, float vy, float radius);
|
std::int32_t Spawn(float x, float y, float vy, float radius);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue