Jump to content

Search the Community

Showing results for tags 'destroy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. Hey community, this is my first post here, I am sharing my scene in which I have used bounce and collision effect of phaser 3 , I have marked comments in order for understanding and reference purposes. The code I have laid down is as follows: window.onload = () => {//creating game window. class MainScene extends Phaser.Scene { preload() {// the following function preloads the image asset required in scene this.load.image("bird", "bird.png"); } create() { this.player = this.add.group();//grouping the sprite in order to load them at diff
  2. Hi, i can't remove the video with video.destroy. It stop it but, it stay on screen. window.onload = function() { var game = new Phaser.Game(674, 520, Phaser.AUTO, '', { preload : preload }); var aide2; function preload() { game.load.onLoadComplete.add(create, this); game.load.atlasJSONArray('closeAide', 'assets/images/closeAide.png','assets/images/closeAide.json'); game.load.video('aide','assets/video/wormhole.mp4'); } function create() { aide = game.add.video('aide'); aide.play(true); aide.addToWorld(); closeAide = game.add.button(20, 20, 'closeAide',cl
  3. I guess this is not a problem if you just reload a page, but my website changes routes without reload. I have a Phaser game running on a page, when I visit another page, I noticed game is still running. I never had to think about how to destroy the game properly since now. How do I destroy a Phaser game, what callbacks are fired and what else do I have to do, to properly destroy a Phaser game.
  4. I'm using the animated tiles plugin from nkholski with the key 'animatedTiles' (how did I come up with that? It's genius). At a certain point I am destroying the game with `game.destroy(true)`. Unfortunately, when creating a new game I'm getting a warning "Scene Plugin key in use: animatedTiles" that then leads to an error "Uncaught TypeError: Cannot read property 'init' of undefined". I've checked the scene and sure enough, the plugin has not been added to it. I tried destroying the game cache before destroying the game, but that just gave me an error too. Josh
  5. I'm trying to create platforms for my player to jump onto and also make collectible stars. I can create these sprites using functions, but I don't know how to make physics work on them so that the character can jump on the platforms and overlap with the stars. The problem is that the physics portion doesn't work when I call it in the update function. I am also not using tilesprites, so it can't work that way. create: function() { addStar(star1); }, update: function() { removeStar(star1); } addStar(name) { name = game.add.sprite(1700, 550, 'star'); name.anchor.setTo(
  6. Hi I'm new to Phaser, so please forgive that I also posted to the Google Group on this subject. I'm not yet sure where it's best to ask this kind of question. I am developing a SPA with Angular2 and so am playing with Phaser 3 as it's modularity seems to enable it to be used with Angular2. I need to be able to load a game, then close it, then load a new game in it's place. What is the proper way to "destroy" a Phaser 3 game please? I note that there is a destroy method in src/scene/System.js as per the attached image. I notice the "TO DO" so it may be that this is just
  7. Hi all, I'm working on my first Phaser based game, online documentaion is very useful, but I can't find informations about destroying instances. function Enemy(game, layer, x, y, enemyStyle){ var newX = 0; var newY = 0; switch(enemyStyle){ case 'big_guy': newX = x; newY = y-68; break; case 'fast_guy': newX = x; newY = y-24; break; } var mySprite = game.add.sprite(newX, newY, decoType); mySprite.anchor.setTo(0.5, 0.5); layer.add(mySprite); } Enemy.prototype.delete
  8. Hello, 1. I created a group groupA in the game. 2. I created a sprite spriteA and added it to groupA. 3. After that I kill() spriteA and keep its reference in a pool array for later use. 4. I destroy() groupA. 5. I get the spriteA from the pool array to be used in another group and try to change its texture with loadTexture(), I get error: phaser2.8.8.js:46794 Uncaught TypeError: Cannot read property 'cache' of null at Phaser.Sprite.loadTexture (phaser2.8.8.js:46794) That doesn't happen if I don't destroy the group in step 4. Could anyone please explain w
  9. Hello there, I'm trying without success to find all stages and renderers that PIXI has in memory, so I can call destroy on them and their children. I'm sure there is a way to have that so I don't have to keep track on my application. It is a React website and therefore the component that had that reference is unmounted and then mounted again later on. When I instantiate a new stage and renderer, I can see them piling up and using a lot of memory as I go from one part of my website to another. How could I find all instances so I destroy them before creating new o
  10. I'm making a simple bug-catching game where the main character catches the bugs using the kill() function when they overlap. It's working, except that he can bounce on the bugs. How can I stop him from being able to bounce on them? The update function looks like this: game.physics.arcade.overlap(this.player, this.fireflies, this.takeFirefly, null, this); and the takeFirefly function looks like this: takeFirefly: function(player, firefly) { firefly.kill(); score++; this.txtScore.setText( score.toString() ); },
  11. Hi! I'm having trouble with destroying the game after use. I'm calling game.destroy(), but this does not properly shut down the core game loop, hence crashing in: c.Game.updatec.RequestAnimationFrame.updateRAFwindow.requestAnimationFrame.forceSetTimeOut._onLoopwith the error: Uncaught TypeError: Cannot read property 'slowMotion' of nullFrom the source code it looks like game.destroy() should cancel all further updates etc. Maybe I'm missing something?
  12. Hi all, I'm trying to use Slick UI to dynamically create multiple choice question prompts in a new game (see image). The problem is, there doesn't seem to be a way to remove a panel, or update its child elements once they have been created. I couldn't find a way to do this directly through Phaser either. Any help greatly appreciated. Perhaps there is a Phaser method to destroy all children generated by a particular plugin? Cheers, Paul.
  13. Hi all, this is my first post here. I have created a game with emitter particles that flow up from the bottom of the game canvas. My question is I want to destroy the partial (sprite) onClick which will in turn give a set value to the score. I cannot for the life of me work out how to destroy the particle on click. any help would be greatly appreciated as I cannot find any documentation specifically for this. Any advice would be greatly appreciated, as I am unsure if the emitter is the best way to achieve what I want. emitter = this.emitter = this.game.add.emitter(this.g
  14. Hey everybody, First of all big thanks to Pixi.js people for the awesome library. I have been using Pixi to develop a simple game and I stumble upon a small bug or I may be doing this wrong. So here is the problem, I got a sprite which contains child's sprites. And I want to destroy it but not the children since I was handling it manually because I need to save the state of each child sprite and then call destroy within them self. So before I calling destroy method I call a custom method on my object, deletingObject.onDestroy(); and then call deletingObjec
  15. hello, I have an error when using destroy() on group.children[0] function create() { boomerangBullets = this.game.add.group(); boomerangBullets.enableBody = true; boomerangBullets.physicsBodyType = Phaser.Physics.ARCADE; boomerangBullets.setAll('checkWorldBounds', false); boomerangBullets.setAll('outOfBoundsKill', true); } function update() { if(game.physics.arcade.distanceBetween(player, boomerangBullets.children[0]) < 30) { boomerangBullets.children[0].destroy(); } } here is an error screenshot --> http://prntscr.com/cnea7s Please
  16. I simply want to know the best approach for destroying a group and everything within the group. According to the documentation: destroy(destroyChildren, soft) Destroys this group. Removes all children, then removes this group from its parent and nulls references. Unfortunately, I'm still finding that my references return an object - not null or undefined For reference, here is a simplified look at the object I'm trying to destroy: class MyObject extends Phaser.Group { constructor(game) { this.game = game;
  17. https://github.com/pixijs/pixi.js/issues/2958 Warning! Your TAB in browser will freeze.
  18. I'm having a hard time triggering onDestroy for my FreezeEffect object. I've essentially set up an object that destroys itself after a few seconds. I've tested and confirmed that "destroyObject" is being called. But sometimes the game ends, the state transitions in the middle of the FreezeEffect, and the "onDestroy" method is never called. I was under the assumption that calling state.start('newState') destroys the Phaser objects in the previous state. Is that not true? Example code: // Freeze Effect FreezeEffect = function (game) { ... constructor code ... ... create twe
  19. I'm trying to remove sprites from a group using destroy() whenever the sprite goes out of the world bounds, but I'm getting an unexpected error: Cannot read property 'world' of null. Any idea why this is happening? function create() { buildings = game.add.group() var building = buildings.create(0, 0, 'building') building.body.velocity.y += 90 building.events.onOutOfBounds.add(onBuildingOutOfBounds, this)}function onBuildingOutOfBounds(building) { building.destroy() console.log(buildings.length)}
  20. Hi I was wondering if I should explicitly destroy all the tweens that I create? I am moving objects on screen every few seconds with one time tweens like so: this.state.add.tween(child).to({ y: prevY + this.blockHeight }, 300, Phaser.Easing.Quadratic.In, true)is it destroyed automatically after the tween is completed or should I destroy it? thanks Lior
  21. When trying to clean up my stage on game over, I loop through my game object groups and destroy all children inside explicitly. Then I destroy the (now empty) groups: cleanGroup(Grp1); // Grp1 is child of Stage groupcleanGroup(Grp2); // Grp2 is child of Stage groupcleanGroup(Grp3), // Grp3 is child of Stage groupcleanGroup(Stage);var cleanGroup = function(Grp) { if (Grp.children) { while (Grp.children.length) Grp.removeChildAt(0).destroy(); } Grp.destroy(); }However, this always gives me a hole bunch of error messages like: this.children is null this.parent i
  22. Hello, I've got a strange error. I've got a quitting menu in my game which basically ask you if you want to quit or not when you click on a button (that part works fine). If ever you answer "Nope" then I will destroy without any mercy all sprites that were used to buld the quit menu (that part kinda works but wait for it...). Problem is if you can't set your mind and you click that quitting button once again, and decide to say no a second time (why would you even do that I don't know but...) and at that point no sprites are destroyed (none, not even one) but the game unpause for the rest of
  23. For example: ...var slide_container_4 = new PIXI.container();var texture = PIXI.Texture.fromVideo(url);var video = new PIXI.Sprite(texture);slide_container_4.addChild(video);...How to destroy video from memory?
  24. Hello, I noticed that events attached on bitmapText objects tend to linger/persist even after the item has been removed/destroyed from the group or even after the group has been destroyed. Does anyone have any idea why is this happening? or how to solve this? I'm attaching the event like this text.inputEnabled = true;text.events.onInputDown.add(fn, this);Thanks!
  25. Can someone please let me know what happens to the local tween when it has finished its tween? TweenOutIngredients: function () {var tweenTray = this.game.add.tween(this.ingredientsTrayGroup); tweenTray.to({x: -900}, 300, Phaser.Easing.Back.In, true); tweenTray.onComplete.addOnce(function(){ this.ResetIngredients(); }, this);},I'm worried if this local tweenTray object will not be picked up by Garbage Collector and will cause memory leak. Also, is there a recommended way to test for memory usage? When making AIR applications, we can just fire up Task Manager and look at adl.exe, I'm
×
×
  • Create New...