fatboyarming Posted April 23, 2018 Share Posted April 23, 2018 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 More sharing options...
fatboyarming Posted April 23, 2018 Author Share Posted April 23, 2018 Oh, I find the solution I add this code, my problem is solved blank_platform.forEach( function(blank_platform){ blank_platform.body.setSize(300, 300, 0, 0); }); Link to comment Share on other sites More sharing options...
Mickety Posted April 23, 2018 Share Posted April 23, 2018 Wouldn't blank_platform.callAll('body.setSize', '', 300, 300, 0, 0); work as well? Anyways It's great that you found your own solution fatboyarming 1 Link to comment Share on other sites More sharing options...
fatboyarming Posted April 25, 2018 Author Share Posted April 25, 2018 On 2018/4/23 at 11:42 PM, Mickety said: Wouldn't balnk_platform.callAll('body.setSize', '', 300, 300, 0, 0); work as well? Anyways It's great that you found your own solution Thanks!!!Your code is really Simple and worK!!! thank you very much!!! have a nice day,THX Mickety 1 Link to comment Share on other sites More sharing options...
Recommended Posts