Théo Sabattié

Members
  • Content count

    36
  • Joined

  • Last visited

About Théo Sabattié

  • Rank
    Advanced Member
  • Birthday 09/11/1994

Contact Methods

  • Twitter
    theoSabattie

Profile Information

  • Gender
    Male
  1. blog? I know only http://www.pixijs.com/. What is the url?
  2. That is more easy to manage sprite positions by grouping them in a container. Invoke Destroy on a container don't destroy children by default : http://pixijs.download/dev/docs/PIXI.Container.html#destroy If you are making a car you won't move the wheels and the car's body distinctly. You shouldn't move all pieces of a gameObject, that is more easier to move only one object.
  3. I retried, that is ok' now. I checked console, I didn't find something in the logs. Good job !
  4. That looks nice but when I click on Start button, nothing happen :/
  5. http://svenfrankson.github.io/PlanetBuilderWeb/index.html Nice !
  6. That is pretty cool! Congratulation for your creation !
  7. I am not sure to understand... Do you want the list reference in each object in it? like var list = [ { id: 'base', prop: 'base_something', myList: // == list }, { id: 'somethingelse', prop: 'anotherprop', myList: // == list }, { id: 'somethingelse42', prop: 'anotherprop42', myList: // == list }, ] ? If it is that, you can do: var list = []; function ListElement(parameters){ // replace name making sens this.list = parameters.list || []; this.list.push(this); this.prop = parameters.prop || "defaultProp"; this.id = parameters.id || "defaultId"; // your own properties instantiation } new ListElement({ list : list, prop : "hello", id : "world" }); Or do you want that the last object of your list have the same property of the first element? Do you want that the last object has alway the same property of first? (if first remove, take new property of new first. If last remove, set property of first on new last ?)
  8. remove ',' at the end
  9. Position is always based on parent.
  10. Hi'' You have to cast your htmlElement: this._canvas = <HTMLCanvasElement> yourHtmlElement; this._canvas = yourHtmlElement as HTMLCanvasElement;
  11. Don't be worry, that is not mine too. I am not sure to understand Why don't you update directly the position ? I don't understand where the conflict come from.
  12. I doubted so I set parenthesis, but you can remove them for that: this.game.input.onDown.add(function(e) { if(e.position.x < this.game.width/2) { moveDirection = -1; } else { moveDirection = 1; } this.player.body.velocity.x = xSpeed * moveDirection; }.bind(this)); In your case, you apply the bind on the add returnment this.game.input.onDown.add( function(e) { /* ... */} ).bind(this); I don't know if add method returns something, but that is not the place to use bind. You have to bind your own object on the callback : this.game.input.onDown.add( function(e) { /* ... */ }.bind(yourObject) ); In this case, this is the Main instance. But if you want, you can bind directly this.player.body.velocity and update x inside callback: this.x += /*..*/ But it will become hard when you will proofread your code to know what "this" represents.
  13. this.game.input.onDown.add(function(e) { if(e.position.x < this.game.width/2) { moveDirection = -1; } else { moveDirection = 1; } this.player.body.velocity.x = xSpeed * moveDirection; }); In callback, or event callback, object is often bind in function (as this); function explanationBind(){ console.log(this); } var lObject = {a:"hello"}; explanationBind.bind(lObject)(); // lObject in console explanationBind(); // Window object in console If you want your object in this method (as this), you have ton bind your object: this.game.input.onDown.add((function(e) { if(e.position.x < this.game.width/2) { moveDirection = -1; } else { moveDirection = 1; } this.player.body.velocity.x = xSpeed * moveDirection; }).bind(this));
  14. Ok'', you can add that: #myCanvas { /* ... */ z-index : -1; }