It's about drag Item issue please help me. save me!


#1

I wanted to do pixel art, so I made the following coding. But the cube is not dragged. What’s the reason? Please help me. Thank you.


#2

Hi @Jeongmin_Park!

Your Blockly script has an old variable called drageditem. It uses no capital i in drageditem while your actual variable is called dragedItem.

To fix this, try renaming your existing variable called drageditem to dragedItem like this:

See .gif example

I recommend using lower camel casing for all variable names to avoid naming problems for your variables.

Variables written in lower camel casing look like this:

  • myVariableName
  • anotherVariableName
  • draggedItem
  • dragZone
  • redCube
  • etc

Here’s how your code would look with lower camel casing variables:

See example

image

Finally, to make your cube move on the item you have to make sure that you rotate the dragZone item so that its top-side is looking at the camera. The method addMoveOnItemInteraction only makes movement on the top side of items possibe.

To fix this, simply rotate the cube like this:

Show .gif example

Finally, you can continue with your pixel art project!

Hope this helps!