dajve

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hi there, I thought I would try Pixi.js for a project, and noted early on that it primarily calls itself a "rendering engine". So my first step was to write the game logic using standard JS. Now the designer has supplied some assets and I'm implementing Pixi. So previously I had classes like this: item = { x: 10, y: 10, update(){ this.x += 1; }, render(){ ctx.fillRect(this.x, this.y, 10, 10); } } My question is, should I keep my logic in the class, something like: item = { x: 10, y: 10, sprite: new Sprite("asset.png"), update(){ this.x += 1; }, render(){ this.sprite.position.set(this.x, this.y); } } That way I still have access to item.x and item.y for hit tests and things like that. Or would it be a good plan to just ditch almost everything I have now, and just use the Pixi Sprite? item = { sprite: new Sprite("asset.png"), setup(){ this.sprite.position.set(10,10); }, update(){ this.sprite.x += 1; } } I'm a relatively seasoned dev, but have zero experience with Pixi. Simple collision detection is probably the only logic I need other than updating positions. What would you do?