-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities don't move #19
Comments
Pretty sure that's on top of the block still. The real issue is the mushroom block isn't moving! |
That's what I meant 📦 |
Mushroom just runs Powerup's constructor with the arguments passed to its own constructor. Here's the constructor for Powerup: constructor(game: SLW, x: number = 0, y: number = 0, xv: number = 1) And here's the line that's constructing Mushroom: const [x, y] = this.game.level.getAbsolutePosition([this.x, this.y])
let shroom = new Mushroom(this.game, x, 0) In that case the |
PS I don't know entirely how that constructor call works lol |
It does have |
So I guess |
Think of it like this: /* Do Y-velocity handling stuff.. */
// (An equivalent to) this happens once the mushroom
// has touched the ground, and on every tick after the
// mushroom's touched the ground:
this.xv = 0
/* Okay, done doing Y-velocity handling stuff.. */
/* Do X-velocity handling stuff.. */
// Huh, this.xv is 0, so don't do anything!
if (this.xv) {
// whatever
}
/* Okay, done doing X-velocity handling stuff. */
|
Of course the question is why this doesn't effect the player sprite, and why it does effect the mushroom sprite - I assume it's because of a bad Y position.... |
Okay, the issue is edit: relevant code: for (let i = 0; i < Math.abs(xv); i++) {
this.x += v
if (this.collides()) {
this.x -= v
if (stop) this.xv = 0
}
} |
The text was updated successfully, but these errors were encountered: