All Activity

This stream auto-updates     

  1. Past hour
  2. Stop all animations in a sprite group

    Ah, I solved it myself, thanks to catching the difference in this example: https://phaser.io/examples/v2/groups/call-all-input this line : cardPack.setAll('events.onInputDown.addOnce', stopAnimation, this); Should read: cardPack.callAll('events.onInputDown.addOnce', 'events.onInputDown', stopAnimation); In case anybody else ends up with this confusion.
  3. Today
  4. Yesterday
  5. Stop all animations in a sprite group

    Hey there! I was wondering how you stop all animations in a sprite group when clicking one of them. I can't seem to get it to work. Heres my code that deals with it: function create(){ cardPack = game.add.group(); cardPack.create(game.world.centerX - 250, game.world.centerY, 'card'); cardPack.create(game.world.centerX - 75, game.world.centerY, 'card'); cardPack.create(game.world.centerX + 100, game.world.centerY, 'card'); cardPack.callAll('animations.add', 'animations', 'flip', [0,1,2,3], 12, true); cardPack.callAll('play', null, 'flip'); cardPack.setAll('inputEnabled', true); cardPack.setAll('input.useHandCursor', true); cardPack.setAll('events.onInputDown.addOnce', stopAnimation, this); cardPack.setAll('input.priorityID', 1); } function stopAnimation(){ cardPack.callAll('animations.stop', 'animations', null, true); } Is the error in the callAll for the animation stop or in the setAlll for event onInputDown? I've tried manipulating both and looking for examples for this but I'm coming up empty handed or just not searching correctly.
  6. Key just pressed event

    Instead of justdown I would do something like this with the first statement the beginning of the update loop. It's also easy to expand to support variable height (higher jumps with longer press time): // The player might try to jump if the jump key has been released while standing on the ground if(!keys.jump.isDown && player.body.blocked.down){ player.allowedToJump = true; } // The jump key is down, the body is on the ground and the player is allowed to jump => jump! if(keys.jump.isDown && player.body.blocked.down && player.allowedToJump){ /* Insert jump code */ player.allowedToJump = false; }
  7. Disposing a mesh

    It's not BJS specific, but JavaScript and is needed. In fact, I'm pretty sure a disposed mesh is left hanging around by BJS as I have ran into that before. As long as there is something in memory pointing at your object then cannot be released from memory. If you are creating a lot of objects and not cleaning up then you will get a large memory footprint or memory leak. The Garbage Collector can't collect objects that have references - it can only collect "garbage" or unreachable objects. So, if ball is a reference that leaves scope then it is also cleaned up, so you don't need to set to null. Good practice to set variables to null and avoid global references.
  8. PIXI.ticker.shared

    because there are no other mechanisms for AnimatedSprite. Pixi doesnt have links between AnimatedSprite and Application. I want to add Stage object that manages it but so far my PR is not investigated.
  9. Generic platformer boilerplate

    I added a title screen running the game itself in a parallel scene in attract mode. The attract mode was made by recording my gameplay in a json and then repeat it. It's buggy and does weird things from time to time due to non-deterministic physics, but I think it looks kind of cool anyway. I also updated the repository. What I really should have done was to clean up the code (and remove some pre-release solutions) but now I added more spaghetti code than ever when hacking in the attract mode.
  10. Phaser 3 JSDoc Generated Typescript Definitions

    I believe so. One way I know of is copying the typescript definition file to the root of your phaser folder in node_modules, and changing the phaser package.json file to have the field "types" : "./phaser.d.ts" in it. Then either restart the TypeScript server in VS Code by pressing CTRL + SHIFT + P and searching "Restart TS Server" or just restarting VS Code. So as long as you're using NPM and RequireJS or ES6 Import, you should be able to use it with vanilla Javascript or ES6. https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html https://code.visualstudio.com/docs/languages/javascript
  11. Unity Material conversion

    Yo... Very cool graphics btw. Great skybox. : )
  12. Stupax - Sidescroller game

    incredbly original idea vary good !
  13. How does Key._justDown work?

    @BlueLemming I'm having the same issue and I'm wondering if this is an oversight. Would it be possible to provide some insight on this, @rich?
  14. Phaser 3 JSDoc Generated Typescript Definitions

    Great! That's what I've been looking for, but can you use this without TypeScript in VSCode using IntelliSense?
  15. Multiple problems with my phaser-project

    Ok, here is the actual status. Now thanks to jdotr with working scale and on Phaser v2.10 Don't be surprised, something is in german, like Sicherungen (=Backup). Bewegung_Playground.rar
  16. Please use game.debug.pointer(game.input.activePointer); to verify where Phaser is placing it.
  17. Multiple problems with my phaser-project

    @Arnon could you put the whole project on GitHub, or attach a zip file?
  18. Image and Button Click Not Working on Android Chrome

    I have the same problem with Phaser CE v2.9.4. The game works well on mobile with Firefox, but not with Chrome. I was able to overcome the problem by using Phaser v2.6.2.
  19. Childs Ticker Listener

    Ivan!!. Im not liking to do so many hack but I don't see other way to do it without waiting for new releases. Please give me you opinion on this, would this fail in any scenario? https://jsfiddle.net/32ce1rcw/15/ PIXI.Container.prototype.onChildrenChange = function(childIndex){ let child = this.children[childIndex] console.log(childIndex, this.children) if(this.children.length > 0 && child.hasCustomEvents != true){ child.hasCustomEvents = true //Define here any custom event let customEvents = ['update','render'] for(let i=0;i<customEvents.length;i++){ let eventName = customEvents[i] if(typeof child[eventName] == 'function'){ child.on('added',function(parent){ console.log('LISTENER ADDED',eventName, child[eventName]) PIXI.ticker.shared.add(child[eventName],child) }) child.on('removed',function(parent){ console.log('LISTENER REMOVED',eventName, child[eventName]) PIXI.ticker.shared.remove(child[eventName],child) }) } } } } Thanks!
  20. Key just pressed event

    I'm working on a simple platformer in my spare time with Phaser 3 and I'm currently working on trying to tighten up my controls. Currently I'm trying to prevent jump spamming so that every jump is an intentional action taken by the player. One press of the jump button should translate to only one jump being performed (ie, key must be released to jump again). Looking at the `Key` class, each key has a property of interest: `_justDown`. This appears to be the property I should use, however it's always `true`. Digging into the source code for v3.1.0 the only time this property is modified is during the process event (`ProcessKeyDown`) and when manually checking using `JustDown`: function create () { this.cursors = this.input.keyboard.createCursorKeys(); } function update () { if (Phaser.Input.Keyboard.JustDown(this.cursors.up)) { // Do some jumping } } This seems to work--sort of--except `ProcessKeyDown` gets called repeatedly and resets the property.. Is there an alternate approach I should be using? I know I could use a jump timer but that seems like a hack. Perhaps this scenario is simply a bug with Phaser at the moment?
  21. PIXI.ticker.shared

    Any reason why is "autoStart=true" by default?, it will be running in the background by default unless I stop it.
  22. Hello 3D guru, According to the docs, we can load objects from *.babylon files this way: var assetsManager = new BABYLON.AssetsManager(scene); var meshTask = assetsManager.addMeshTask("skull task", "", "scenes/", "skull.babylon"); ... assetsManager.load(); Imagine, that *.babylon file contains many objects and I load these files dynamically, one by one. Later I want to delete/dispose all objects loaded from the specific file - how do I do that? Is there a built in way? Probably I could store all mesh names in a dictionary where keys are *.babylon file names, then in a loop go through the dict key values and dispose meshes. But maybe there is a shorter and more beautiful way?!
  23. [SOLVED] Blender to babylon.js issue

    A better place to change would be where hasUnAppliedTransforms is determined. I did quite follow all that work flow. An armature modifier can be on a mesh & exported where the parent is not also the armature, but I do not know how to get automatic weights that way. Perhaps, abs() could be used in the check to mitigate this -0 stuff. # ensure no unapplied rotation or scale, when there is an armature self.hasUnappliedTransforms = (self.scaling.x != 1 or self.scaling.y != 1 or self.scaling.z != 1 or (hasattr(self, 'rotation' ) and (abs(self.rotation .x) != 0 or abs(self.rotation .y) != 0 or abs(self.rotation .z) != 0)) or (hasattr(self, 'rotationQuaternion') and (abs(self.rotationQuaternion.x) != 0 or abs(self.rotationQuaternion.y) != 0 or abs(self.rotationQuaternion.z) != 0 or self.rotationQuaternion.w != 1)) )
  24. PIXI.ticker.shared

    Shared ticker has "autoStart=true" so it starts just when you add the listener. https://github.com/pixijs/pixi.js/blob/dev/src/core/ticker/Ticker.js#L262 Create AnimatedSprite, play it and shared ticker will be started. I dont use shared ticker for personal projects.
  25. Childs Ticker Listener

    Pixi doesn't have special logic regarding adding/removing listeners for ticker. I have PR for PIXI to improve the situation: https://github.com/pixijs/pixi.js/pull/4586 For now you have to make your own system that tracks instanced that has to be updated.
  26. Childs Ticker Listener

    Hello, I have a PIXI app with many child (in a tree structure). I need to update only child that contains the method "update". There is any logic inside PIXI for this or I would need to add each of those object in the shared.ticker? I did this, but there could be a better way that could allow me to remove the ticker listener if I need to. THIS IS NOT FOR SPRITE ANIMATIONS, it's mostly to change objects position https://jsfiddle.net/32ce1rcw/2/ Thanks.
  27. Disposing a mesh

    Hi, On a Stackoverflow found an advice to set the mesh variable to null after the dispose call (to tell the GC he can collect). Something like: ball.dispose(); ball = null; ... is this needed nowadays or is already implemented in BJS ?
  28. Phaser 3 JSDoc Generated Typescript Definitions

    I haven't tested everything yet but using my modified version of Antriel's official (WIP) Phaser 3 typescript definitions build, I was able to get scene properties (plugins) to work using a hacky generator by stepping through Phaser code with the browser debugger, converting any useful runtime data to JSON, writing it to disk, then converting it with a simple script, and injecting it into Antriel's build. End result: Everything appears to be compiling in the typescript compiler so far, with code hinting, autocompletion/intellisense, ect. in VS Code (and I imagine similar editors). Note: This is a temporary, hacky, potentially unstable solution for those who want to start building their Phaser 3 typescript projects right now while we wait on offical typescript support to be completed by Antriel and the Phaser team. Modified build here: https://github.com/troyedwardsjr/phaser3-tsd/blob/master/build/official/phaser.d.ts Also created a boilerplate starter project, with definitions included: https://github.com/troyedwardsjr/phaser3-typescript-webpack
  1. Load more activity