Search the Community
Showing results for tags 'comet'.
-
Hello, First post there, little bit nervous I am currently developing a little game using PIXI, but got stucked with pixi-particle related problem. Link to game As anyone can see my player 'spells' aka particles, are changing their respective position with their emitter (emitter and particles are moving). What i want to achive is comet-like animation (like when mousemoving, using Pixi-particles-editor). Let's proceed to the code. import { ParticleContainer, loader } from 'pixi.js'; import { Emitter } from 'pixi-particles'; import { Spellbook as SPELLCONFIG } from './SpellTypes/Spellbook'; export default class Spell extends ParticleContainer { constructor(name, player) { super(); super.setProperties({ scale: true, position: true, rotation: true, uvs: true, alpha: true }); this.name = name; this.playerName = player.name; this.spellEmitter = new Emitter(this, loader.resources.basicparticle.texture, SPELLCONFIG[name].emitter); this.spellEmitter.updateOwnerPos(player.x, player.y); this.direction = player.rotation; this.velocity = SPELLCONFIG[name].velocity; } update(delta) { const newX = this.spellEmitter.ownerPos.x + Math.sin(this.direction) * this.velocity; const newY = this.spellEmitter.ownerPos.y - Math.cos(this.direction) * this.velocity; this.spellEmitter.updateOwnerPos(newX, newY); this.spellEmitter.update(delta); } } Was trying to add resetTrackingPosition() before updateOwnerPosition() after analyzing pixi-particles example code. (and dozen of other solutions, but nothings worked as i intended) Imho, theres something deeply misunderstood by me about pixi-particles system, so i have to ask here Oh, whole game code can be found at my github project page. (Folder Spells is the one with particles code) There are spells named "avada", "bariero", "stupefy" with their configuration (precisely - emitter settings) files. PS. i am aware of particleContainers not being destroyed. PS2. Sorry for my English, it's not my native. But tryin my best
- 3 replies
-
- pixi-particles
- comet
-
(and 1 more)
Tagged with: