Re: How I can create Block In certain position...?

59 views
Skip to first unread message
Message has been deleted

Beka Westberg

unread,
Jun 23, 2019, 10:14:38 AM6/23/19
to Blockly
Hello,

To create a block relative to another block you will need to use the getRelativeToSurfaceXY function to get the coordinates of the original block. Then you can either include that in the XML definition of a block which you would pass to appendDomToWorkspace, or use the moveBy function on the block once it has been created.

Here's an example of a block defined in XML with x & y coordinates:
<block type="controls_if" x="10" y="10"></block>

I hope that helps! If you have any further questions please reply.
Beka

On Saturday, June 22, 2019 at 3:43:04 AM UTC-7, Dadsam Gamer wrote:
How I can create Block In certain position(X,Y) or In front Of Another Block(type copy and paste a Block)?


Thanks you.

Dadsam Gamer

unread,
Jun 24, 2019, 7:35:31 PM6/24/19
to Blockly
Thanks Beka!
Reply all
Reply to author
Forward
0 new messages