javascriptgame-developmentphaser-frameworkphaserjs

Image won't show on screen when visable attribute is set to true in Phaser


I have an image that I want to be invisible at the start of the game and then pop up later on screen to be hidden again later. This is the code I have for making the image in the create function:

sign1Info = this.add.image(200, 200, "sign1").setScale(4);
sign1Info.visible = false;

Then later in the create function I have an object to access it:

sign_dict = {"sign1" : sign1Info};

Then finally in the update function I have the code that should make the image visible:

sign_dict[signName].visable = true;

The code in the update block will cause the attribute for visible to turn to true in the Firefox developer tools but won't actually be visible on screen unless I just write:

sign1Info.visible = true;

,in the update function.

How can I make the image appear using the object method or something similar?


Solution

  • It looks like you spelled visible wrong in the snippet

    sign_dict[signName].visable = true;
    

    try changing it to say

    sign_dict[signName].visible = true;