Skip to content

Player graphic sometimes shows on the board, and sometimes does not load #2

Open
@davidakimbo

Description

@davidakimbo

We have an initialize function that loads two graphic files. A grid bitmap image and a bird.

From how we staggered the functions, the grid should load first and then the bird graphic on top. We even put the loadBirdGraphic inside the loadGridGraphic and updated the stage accordingly.

As it currently runs, the bird does not load at all every couple of reloads and we don't know where the issue lies.

Code Snippet:
function loadGridGraphics() {
background = new createjs.Bitmap(backgroundImage);
stage.addChild(background);
setTimeout(stage.update(), 50);
loadBirdGraphics();
stage.update();
}

function loadBirdGraphics() {
bird = new createjs.Bitmap(birdImage);
bird.x = startRow;
bird.y = startCol;
stage.addChild(bird);
stage.update();
}

We call loadGridGraphics at some point after the DOM has loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions