Jump to content

Trying to add a child to another object, but it isn't moving with the parent!


lilsheep
 Share

Recommended Posts

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);
};

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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