Jump to content

[Solved]How to set body Size on group for each sprite?


fatboyarming
 Share

Recommended Posts

Hello everyone, I would like to create a platformer game and need to create a blank platform without image

Here is my code

blank_platform = game.add.group(); 
blank_platform.create(700, 500, null); 
blank_platform.create(1500, 500, null); 
blank_platform.enableBody = true; 
blank_platform.setAll('body.immovable', true);

//Try to set their body size but not work
blank_platform.body.setSize(300, 300, 0, 0); 

//and try to use the follow method, but still not work
blank_platform.setAll('body.setSize',[300, 300, 0, 0]); 

 

but still not work  and show this error 

Uncaught TypeError: Cannot read property 'setSize' of undefined

 

Have any idea?? thank you very much

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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