lilsheep Posted May 20, 2015 Share Posted May 20, 2015 I am trying to get structure to be glued to cobblestone ground! So that their X values are dependent!However cobblestone ground just stays in the same place(on the screen, setViewportX doesn't do anythin!) function Background() { var texture = PIXI.Texture.fromImage("cobblestone_ground.png"); PIXI.TilingSprite.call(this, texture, 4000, 100); this.position.x = 0; this.position.y = 370; this.tilePosition.x = 50; this.tilePosition.y = 0 ; this.viewportX = 1000; var structure = new PIXI.Sprite(PIXI.Texture.fromImage("spire.png")); structure.position.y = -100; this.addChild(structure); }; Quote Link to comment Share on other sites More sharing options...
xerver Posted May 20, 2015 Share Posted May 20, 2015 I don't know what "setViewportX" will do so I can't tell you, but changing "Background" position should seem to move the structure since it is a child of Background. If not, show me an example that doesn't work an I can look into it. 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.