lilsheep Posted May 21, 2015 Share Posted May 21, 2015 So each player object has a different playername.text_x number. The correct one! But only one is rendered! : ( Why? The constructor is below! var player = function () { var health = new PIXI.Graphics(); health.beginFill(0x00FF00); health.drawRect(0, drawAtY-50, 100/2.2, 6); health.endFill() //console.log("MAN STAGE "+MAIN.stage); MAIN.stage.addChild(health); var text_x; this.drawText = function(){ text_x = Math.abs(768/2) - localPlayer.localX() + drawAtX; this.text_x = text_x; health_shadow.position.x = text_x-25; health_shadow.position.y = drawAtY-100;} Quote Link to comment Share on other sites More sharing options...
lilsheep Posted May 21, 2015 Author Share Posted May 21, 2015 Ok this problem is bizzare because it works for one of the objects. Namely what appear to be the first object that is created with hte constructor. It is like that rectangle can only exist once. Quote Link to comment Share on other sites More sharing options...
lilsheep Posted May 21, 2015 Author Share Posted May 21, 2015 Ok I see. The tutorial I read that explained the parameters for drawRect was off. I thought the first two parameters didn't matter, I thought the last two parameters were dependant to that. I was wrong. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.