Search the Community

Showing results for tags 'loops'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 6 results

  1. Hi. I'm having trouble with an animation. The animation is 3 frames, and is a static image until the user ciicks in, and animates it, which should happen in a loop. Instead, the frames play once then the entire thing disappears from the screen. How do I get it to loop? Also, ideally I'd have it loop a number of times then stop. I see there's an example for loop counts in the Phaser documentation, but that doesn't seem to work either... preload: function () { this.load.spritesheet('spritesheet', 'pngs/sprites.png', 99, 79, 3); }, create: function () { this.sprites =, 60, 'sprites'); this.sprites.inputEnabled = true;, this); } spritesanim: function(){ this.animat = this.sprites.animations.add('swing');'swing', 20, true); },
  2. Hello. When I use forEachAlive loop on a group I see that it goes in ascending index order, I need to loop through group children in reverse order without changing their indexes or display order. I searched on google, in documentation ad in examples but I can't find a solution. I will be very grateful for any help.
  3. I been having an issue while looping through 2 groups and got this error, what I think this means is one of the objects is undefined. Uncaught TypeError: Cannot read property 'width' of undefined This is code (which is in Typescript) that causes the error: for (var i = this.tris.children.length - 1; i >= 0; i--) { for (var s = this.squares.children.length - 1; s >= 0; s--) { if(Overlap(this.tris.children[i],this.squares.children[s])){ this.BreakTris(this.tris.children[i]); this.BreakSquare(this.squares.children[s]); } } } The error is given specifically for the Overlap function. Two loops which go through 2 groups in order to compare each sprite of both groups to each other and check for Overlap, which is as follows: function Overlap(spriteA, spriteB) { var boundsA = (spriteA instanceof Phaser.Sprite) ? spriteA.getBounds() : spriteA; var boundsB = (spriteB instanceof Phaser.Sprite) ? spriteB.getBounds() : spriteB; return Phaser.Rectangle.intersects(boundsA, boundsB); } I don't see what i'm doing wrong? Thanks for reading.
  4. Dear Friends, I am a German Composer and Sound designer living in the Netherlands. My work is licensed by many clients, such as government officials, creative agencies, publishers, film makers, animators, photographers and web companies (Google).Summary: composing of classical / contemporary music and soundtracks for commercials, movies, games, animation, trailers 20+ years of playing the classical piano with certificate sound design (stingers, trailers, soundlogos, atmospheres, one-shots) Examples of my work: 8Bit-ish game-oriented tune soundtrack for a children's game browser strategy soundtrack ios shooter game soundtrack explainer - background music and final mix classical showreel my stockaudio collectionContact me via PM or the contact form on my website: soon!Robert
  5. I have no particular problem,but I was wondering... Wouldnt I be able to use the while statement instead of using the built-in animation. And if the while statement were to work, wouldnt be faster than the built-in animation?
  6. Hello, I have started developing with canvas and JS this week and have a few questions on the structure of a program..... When is it appropriate to create a new file that declares an object? so far I have been declaring my objects using the object literal method in a single file but its coming close to 300 lines and I am now wondering if I should start making new files for my objects. for example, I want to make a gun class which acts as a parent class for all gun types. I have made a new JS file and have added this: function Gun(){ this.x=0; this.y=0; this.image1=9; this.image2=10; this.width=36; this.height=32; this.pickedUp=false;}now, would it be more efficient to declare this using object literal in the other file? Or should I continue writing this one and make a loop function in this file that handles all the actions that I would normally put in the other (300 line) file?