Skip to content

Only two of the four enemy animations are being played. #14

@DCCoder90

Description

@DCCoder90

Currently in Game/LeafMan.cpp in the update function:

void LeafMan::Update(){
    std::weak_ptr<GameObject> playerGoPtr = Game::GetInstance().GetCurrentState().GetObjectByComponent("Player");
    std::shared_ptr<GameObject>  playerGo = playerGoPtr.lock();

    //Move enemies towards player
    if (parent.box.x < playerGo->box.x) {
        spriteSheet->SetCurrentAnimation("walkdown");
        parent.SetPos(parent.box.x + speed,parent.box.y);
    }
    if (parent.box.x> playerGo->box.x) {
        spriteSheet->SetCurrentAnimation("walkup");
        parent.SetPos(parent.box.x - speed,parent.box.y);
    }
    if (parent.box.y < playerGo->box.y) {
        spriteSheet->SetCurrentAnimation("walkright");
        parent.SetPos(parent.box.x,parent.box.y+speed);
    }
    if (parent.box.y > playerGo->box.y) {
        spriteSheet->SetCurrentAnimation("walkleft");
        parent.SetPos(parent.box.x,parent.box.y-speed);
    }
}

Only the left and right walk animations are being played. If this is a bug in LeafMan.cpp it should be notated as such and closed. If this is a bug in the SpriteSheet it should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions