Chomper Movement Patterns?
8 years ago
Michigan, USA

Hi, OTS community!

From the looks of it, you guys all got done shredding this game a while ago, and I'm very late to the party, but I just wanted to say I've had a blast watching many of your runs and trying a few myself. I'm learning... slowly... and I had one curiosity, just in case it can be helpful to a run somewhere.

What determines the movement of Chompers? The first several times, I assumed they just moved on a fixed path, and that the cycle started when the room loaded. But I've noticed in Null Field, that little guy doesn't always behave predictably. Sometimes he does his thing, but sometimes he gets squashed. If I die just past the checkpoint, a lot of times he gets bopped when the room reloads. Then, sometimes if I feel punchy and spam teleport shots, the same thing happens. Is it that the game just tells it to turn around at set intervals, and reloading the room/mashing commands de-syncs those intervals?

I can only think of two or three rooms that even involve close calls with Chompers, and so I don't know if this is worth exploring if not known. I'm just really curious if anyone happens to know!

Denmark

As far as I know they move at a fixed speed until they encounter an obstacle at which point they turn around. I have also noticed some inconsistencies and Null Field is the most notable example, and I think it's due to an uneven framerate. Loading a room always reduces framerate a little and with all the weird effects in Null Field along with you possibly teleporting, a little variability is unfortunately unavoidable.

The code that is actually responsible for movement of chompers is (Action/game/enemy/Components/Goomba.as):

if (this.debug_face_x < 0 || this.debug_face_x > level.width || level.hasMovingPlatformAt(new Rectangle(this.debug_face_x, enemy.y - enemy.body.height / 2, enemy.body.width, enemy.body.height)) || !_loc_2 || _loc_2 is OneWayBlock || _loc_2 is FragileBlock || _loc_2 is Slope || _loc_3) { this.side = this.side ¤ -1; } else { enemy.x = enemy.x + this.speed ¤ Constants.SECS_PER_STEP ¤ this.side; }

The if statement is true if something is blocking the movement of the chomper, in which case the movement direction is reversed by negating the side variable. If nothing is blocking the movement, then its horizontal position is shifted by the constant speed / FPS to the side the chomper is currently moving.

PrettzL, rezoons, and MIDIbusker like this
Michigan, USA

Thank you so much! I have very little coding experience (from a long time ago) and so I wouldn't have known what to do with that information even if I had found it myself.

Game stats
Followers
105
Runs
428
Players
109
Latest threads
Posted 2 years ago
27 replies
Posted 6 years ago
1 reply
Posted 7 years ago
4 replies
Posted 7 years ago
21 replies