Set Drag Mode ()
set drag mode [draggable v]
Category Sensing
Type Stack
Introduced in 3.0

The Set Drag Mode () block is a sensing block and a Stack Block. It sets the sprite to draggable or not draggable. Before Scratch 3.0, it was not possible to set the draggability of a sprite using a block. This block is not available for the stage. Upon the release of Scratch 3.0, this became the only way to set sprite to draggable, due to the removal of the Draggable Sprite Feature.

Usage

The dropdown has two options: draggable and not draggable. These change the sprite's draggability. If a sprite is non-draggable, it is normal, and if it is draggable, it can be dragged without a shadow, even in the player and fullscreen options. It can be used to drag a sprite in a project without needing a script for dragging. It can also be used for certain drag and drop game mechanics.

Example

  • After the start of the game is broadcasted, the sprite can be dragged.
when I receive [start game v]
set drag mode [draggable v]
  • The sprite can be dragged if the space key is pressed.
forever
    if <key (space v) pressed?> then
        set drag mode [draggable v]
    else
        set drag mode [not draggable v]

See Also

References


Cookies help us deliver our services. By using our services, you agree to our use of cookies.