Sign in to follow this  

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

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 =; 
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

Share this post

Link to post
Share on other sites
On 2018/4/23 at 11:42 PM, Mickety said:


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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.