gregkarber

Members
  • Content Count

    28
  • Joined

  • Last visited


Reputation Activity

  1. Like
    gregkarber got a reaction from ritherz in My game works, but I want it to work faster   
    I think I implemented your suggestion! It still could run a little faster, though...
    function circleCreate() { var circleSize = Math.random() * 50 + 60; asteroidCircle = game.add.bitmapData(100, 100, "asteroidBit", true); asteroidCircle.circle(50, 50, 50, "#FFFFFF") asteroidGroup = game.add.group(); asteroidGroup.createMultiple(100, asteroidCircle); }function asteroids(x, y) { //console.log("asteroid at " + x + "," + y); var circleSize = Math.random() * .5 + .5; asteroid = asteroidGroup.getFirstDead(); asteroid.reset(x,y); asteroid.anchor.x = .5; asteroid.anchor.y = .5; asteroid.scale.x = circleSize; asteroid.scale.y = circleSize; game.physics.p2.enable(asteroid, false); asteroid.body.clearShapes(); asteroid.body.addCircle(circleSize * 50); asteroid.body.setCollisionGroup(asteroidCollisionGroup); asteroid.body.collides([shipCollisionGroup, asteroidCollisionGroup]); asteroid.body.debug = true; asteroid.body.velocity.x = Math.random() * 50 - 25; asteroid.body.velocity.y = Math.random() * 50 - 25; this.spacerocks.add(asteroid); }