Skip to content

rectangleCollision (and possibly others) seem to break with constant acceleration mechanic  #12

Description

@jbockmon

I have a platfomer with a constant acceleration built in to simulate gravity:

let playerGravity = 0.2;
playerSprite.vy += playerGravity;

collision detection for playerSprite and array of sprites that are allowed to collide with the playerSprite:

if( b.hitTestRectangle(playerSprite, collSprites[i])){
b.rectangleCollision(playerSprite, collSprites[i], false);

where:

b = new Bump(PIXI);

on "impact" where playerSprite lands on top of a tile with which it can collide first aligns the playerSprite to the tile, then after ~1 second @ 60fps, the playerSprite disappears. Movement is also hindered after collision to whole tiles before playerSprite disappears.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions