Jump to content

Matter.js physics problem. i need help to fixed ?


d0zzerr
 Share

Recommended Posts

preload(){
		this.load.atlas('sheet','img/images.png','img/images.json');
		this.load.json('shapes','img/shapes.json'); 
	}

create() {
  
  this.shapes = this.cache.json.get('shapes');

  this.platform = this.matter.add.sprite(x,y,'sheet','platform.png',{ shape: this.shapes.platform}); //  add sprite

  this.bottle = this.matter.add.sprite(this.width/2,this.height-24-16,'sheet','Bottle.png',{ shape: this.shapes.Bottle}); 
		this.bottle.setBounce(0.5,0.75);


// for(let i=0;i<5;i++){
  // 	     let x = 64+Math.floor(Math.random()*(this.width-64));		
   //        let platform = this.matter.add.sprite(x,2*this.height/3 - i*156,'sheet','platform.png',{ shape: this.shapes.platform});
  // 		}


}


 

First of all my English a little bad sorry for that. 

When i add platform and bottle on the screen  it working properly. But when i want to create one more platform same code after the bottle create it doesnt work. If i try to add before the bottle it work good.  i added media that show you wrong



working : https://youtu.be/W470LsI9IWI

this is the not working https://youtu.be/1GBtUHbRPiE 
 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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