Jump to content

trouble with dynamic text


Recommended Posts


I'm a newbie with pixi and am really enjoying it, I am creating a simple game but I cannot get the scoreboard to update dynamicaly, I can see the score increase in my console.log(score) but the number on screen remains at number 1. I have looked at online and at the manual and have tried .content but to no avail, what am I doing wrong ? I losing my hair

Below is my basic script :

var Container = PIXI.Container,
    autoDetectRenderer = PIXI.autoDetectRenderer,
    Graphics = PIXI.Graphics,
    Sprite = PIXI.Sprite,
    MovieClip = PIXI.extras.MovieClip,
    TilingSprite = PIXI.extras.TilingSprite,
    loader = PIXI.loader,
    resources = PIXI.loader.resources,
    Text = PIXI.Text;
    TextureCache = PIXI.utils.TextureCache,
    Texture = PIXI.Texture;

//Create a Pixi stage and renderer
var stage = new Container(),
    renderer = autoDetectRenderer(256, 256);

//Scale the canvas to the maximum window size
var scale = scaleToWindow(renderer.view);

//Set the initial game state
var state = play;

//load resources

//Define any variables that might be used in more than one function
var gameScene = undefined, // container
    state = undefined;
    score =1;
    message = undefined;

function setup() {

  gameScene = new Container();
  message = new Text(score, {fill:"white"});
 state = play;
  //Start the game loop

function gameLoop() {

  //Loop this function 60 times per second

  //Run the current state

  //Render the stage

function play()
    message.content = score;

Thanks in advance to anyone who can help me


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...