Jump to content

Giving objects in a group velocity


Gameventions
 Share

Recommended Posts

Hi I am new to phaser,  having trouble manipulating objects that are in a group:

    this.game.physics.startSystem(Phaser.Physics.ARCADE);    this.game.physics.arcade.gravity.y = 60;        this.allAsteroids = this.game.add.group();	this.asteroid = this.allAsteroids.create(DoomSpinner.convertWidth(400), DoomSpinner.convertHeight(50),'white1');	this.game.physics.arcade.enableBody(this.asteroid);	val = Math.random()*30-15;	this.asteroid.velocity.x=val;	this.asteroid.body.angularAcceleration = val;

I get a cannot set property 'x' of undefined error.   I plan on having lots of asteroids, so how can I give them velocity and still use them in a group?

 

Thanks for answering the noob question.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...