Discuss Scratch
- Discussion Forums
- » Suggestions
- » Disable Sprite Draggability When Project is Running
- turkey3
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
Even if you don't have the box checked that the “sprite is draggable”, unless the project is in full screen, you can still drag sprites around while the project is running. The whole point of dragging sprites around is to place them correctly, but then when viewing projects not in full screen I accidentally drag them around. I think it should be implemented so while the project is running, no sprites will be dragged by the mouse, unless the box is checked.
- dusty22
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
I think the ‘sprite is draggable field’ only applies to projects in the player (as in when you're looking at the main project page and playing it there as opposed to being in the Scratch studio). If you're inside the studio/editor sprites are always draggable I think unless you're in full screen like you said.
Like the Megaman X series? Want to make Megaman games in Scratch? Check out my studio here, The Megaman X Scratch Engine.
- musassayed
- Scratcher
1 post
Disable Sprite Draggability When Project is Running
You can disable dragging.
when green flag clicked
delete ( v) of [ v]
add [] to [ v]
forever
...
- DaSpudLord
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
I support for disabling dragging while a project is running in editor (unless the draggable option is selected). It's actually kind of annoying to have to enter fullscreen whenever I want to run a project without accidentally dragging something.
Last edited by DaSpudLord (March 14, 2016 21:54:06)
| Primary Target | Fireworks Show! Wheel of Fortune || Block Buster ||||| Shut the Box ||||||||| Surf's Up! |||||
U^ェ^U::motion//This is Blocky. He lives in my signature. He is a trained attack block. He protects my siggy from kumquats.
- Inreal49
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
Removed
Last edited by Inreal49 (March 14, 2016 22:44:28)
Yes
- Inreal49
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
no sprites will be dragged by the mouse, unless the box is checked.Even if you don't have the box checked that the “sprite is draggable”, unless the project is in full screen, you can still drag sprites around while the project is running. The whole point of dragging sprites around is to place them correctly, but then when viewing projects not in full screen I accidentally drag them around. I think it should be implemented so while the project is running,
good idea, support
Yes
- deenfoxx
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
I'm trying to programmatically create my own drag-and-drop, since I can't find any “when this sprite is dragged” hat blocks or sensing blocks to know when users are dragging sprites around. The problem? I can't actually test it unless I leave the editor because the built-in editor's drag feature takes over and is conflicting with my code…
Any suggestions?
if <<touching [mouse-pointer v] ?> and <mouse down?>> then
repeat until <not <mouse down?>>
go to x: (mouse x) y: (mouse y)
end
end
Any suggestions?
- WolfCat67
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
Woah, this isn't the correct place to put this! I'll request for a moderator to make this it's own topic in Help with Scripts. I'm trying to programmatically create my own drag-and-drop, since I can't find any “when this sprite is dragged” hat blocks or sensing blocks to know when users are dragging sprites around. The problem? I can't actually test it unless I leave the editor because the built-in editor's drag feature takes over and is conflicting with my code…if <<touching [mouse-pointer v] ?> and <mouse down?>> then
repeat until <not <mouse down?>>
go to x: (mouse x) y: (mouse y)
end
end
Any suggestions?
- deenfoxx
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
No need. I meant it as a suggestion for Scratch to not allow dragging of objects when scripts are running… Just agreeing with the others.
Anyway, I made my own solution (kinda) to the drag-drop issue…
https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/152271898/
Instead of dragging the current sprite, I hide it when clicked and drag another sprite instead. But, the editor STILL picks up sprites sometimes before my code gets to the hide block.
SO… Yes, this is a suggestion for the Scratch programming team to not allow drag and drop on sprites in editor during execution of a script… unless, of course, it is allowed by checking the “can drag in player” checkbox.
Anyway, I made my own solution (kinda) to the drag-drop issue…
https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/152271898/
Instead of dragging the current sprite, I hide it when clicked and drag another sprite instead. But, the editor STILL picks up sprites sometimes before my code gets to the hide block.
SO… Yes, this is a suggestion for the Scratch programming team to not allow drag and drop on sprites in editor during execution of a script… unless, of course, it is allowed by checking the “can drag in player” checkbox.
Last edited by deenfoxx (March 25, 2017 05:58:26)
- TheLogFather
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
Yeah, this is one of those annoying niggles of Scratch – you want to test your scripting while in the editor, but can't because of drags… Yes, this is a suggestion for the Scratch programming team to not allow drag and drop on sprites in editor during execution of a script… unless, of course, it is allowed by checking the “can drag in player” checkbox.
Particularly since having your own drag scripts gives way more control, so anyone who wants to really make dragging work well would rather avoid using Scratch's (untrackable in real-time, not to mention sometimes glitchy) built-in drag.
If the testing involves dragging, and I'm in editor mode, what I tend to do is just hit the fullscreen button. That covers most situations.
Still, I think it'd be handy to have some way to disable dragging while in editor mode…
The alternative might be to improve Scratch's built-in drag, so that, for a start, we can switch it on/off for a specific sprite/clone via script:
set sprite dragging to [on v] :: motion // if switched off during drag then sprite/clone is dropped…and make it so the x/y position is updated in real-time during the drag.
Last edited by TheLogFather (March 26, 2017 12:42:07)
Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- deenfoxx
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
The alternative might be to improve Scratch's built-in drag, so that, for a start, we can switch it on/off for a specific sprite/clone via script:set sprite dragging to [on v] :: motion // if switched off during drag then sprite/clone is dropped…and make it so the x/y position is updated in real-time during the drag.
Good idea. THIS would be extremely beneficial for some projects. I could easily imagine a puzzle game where all the pieces are clones… as soon as you fit them into the appropriate placement they would lock into place and not be able to be moved again. But also add a sensing block and ability to control the position of the object being dragged…<sprite being dragged? ::sensing>
So we could do something like this…repeat until <not <sprite being dragged? ::sensing>>
if <(mouse x) > [200]> then
set x to (200)
else
if <(mouse x) < [-200]> then
set x to (-200)
end
end
if <(mouse y) > [150]> then
set y to (150)
else
if <(mouse y) < [-150]> then
set y to (-150)
end
end
end
Maybe even a hat block…when this sprite is dragged :: events hat
Last edited by deenfoxx (March 26, 2017 15:53:31)
- TheLogFather
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
I think the “when this sprite clicked” is enough to detect that.
As long as dragging a sprite/clone will also trigger that hat block then we can use a script to ‘track’ the drag (and tell when dropped by using <not <mouse down?>>).
I guess that does mean we end up doing almost everything as if it's our own drag script – except the need to track the cursor position, and deal with the offset of sprite centre from cursor.
But the upside is that we get to write drag scripts that are compatible with the built-in drag while in editor, and if you don't want that extra control, all you do is click “drag in player”, just as it is at the moment (i.e. nothing is actually lost).
As long as dragging a sprite/clone will also trigger that hat block then we can use a script to ‘track’ the drag (and tell when dropped by using <not <mouse down?>>).
I guess that does mean we end up doing almost everything as if it's our own drag script – except the need to track the cursor position, and deal with the offset of sprite centre from cursor.
But the upside is that we get to write drag scripts that are compatible with the built-in drag while in editor, and if you don't want that extra control, all you do is click “drag in player”, just as it is at the moment (i.e. nothing is actually lost).
Last edited by TheLogFather (March 26, 2017 15:59:43)
Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- deenfoxx
- Scratcher
100+ posts
Disable Sprite Draggability When Project is Running
Yeah… We'll just have to deal with switching to full screen every time to test for now, I guess. I'm planning on playing with a bit of makeshift physics, such that my letters will dangle (swing) left and right as you move around. Not done yet.
Fridge Magnets
https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/152271898/
I don't like the flicker it has as it switches back to the other sprite when dropped. Not sure if I'll pursue this project anyway… If I do what I want, and get it fully functional with multiplayers using cloud variables, Scratch will probably just delete it as a “chat room” anyway.
Fridge Magnets
https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/152271898/
I don't like the flicker it has as it switches back to the other sprite when dropped. Not sure if I'll pursue this project anyway… If I do what I want, and get it fully functional with multiplayers using cloud variables, Scratch will probably just delete it as a “chat room” anyway.
Last edited by deenfoxx (March 26, 2017 16:38:22)
- TheLogFather
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
That's due to the “broadcast and wait” waiting for the next screen refresh after the mover sprite has hidden, and before the script following the broadcast gets a chance to run and so show the clone again. I don't like the flicker it has as it switches back to the other sprite when dropped.
This project uses a similar mechanism to the one you've used in your project – i.e. the drag actually happens on a different sprite: https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/131157377/
And I had to work around the exact same issue – and, yes, it was a pain…
IIRC, the key thing was to not have the “and wait” for the drag broadcast, but to have a separate broadcast when the drag ended (in the dragging script), and have the receiver scripts for that do the necessary stuff to finish off the drag (hiding the drag sprite, re-showing the original clone that got hidden). That way you avoid having any chance for a refresh to happen between the hide of the sprite and the show of the clone.
Last edited by TheLogFather (March 27, 2017 13:49:04)
Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- Wahsp
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
Wait, so the post that bumped this was removed? Why not close the topic?
I am Wahsp
______________________________________________________
Formerly pretty active on the forums, probably mostly retired now…
If you see one of my posts send me a hello!
______________________________________________________
- BB1000000000
- Scratcher
34 posts
Disable Sprite Draggability When Project is Running
I think that you can use the following code:
However, in Scratch 3.0, there is a new block in the Sensing tab called
when gf clickedYou can also use the previous code in Scratch 1.4. This will still allow dragging, but when the mouse is released (mouse down = false), the sprite immediately jumps back to it's original position.
go to x: (x) y: (y)
forever
go to x: (x) y: (y)
However, in Scratch 3.0, there is a new block in the Sensing tab called
set drag mode [not draggable v] :: sensingblock that does the same thing. In fact, it is the only way to set a sprite as draggable or not draggable, due to the “draggable on website” (1.4) and the “can drag in player” (2.0) being removed.
Last edited by BB1000000000 (Dec. 9, 2019 23:19:12)
Feeling like giving an internet? Give them here! (I would have used the actual badge, but internetometer.com isn't a whitelisted image host.)
BB1000000000
Been Scratching since September 2018 (the near-end of Scratch 2.0), created this account in December 2019.
I play Minecraft and Among Us, and program in C++ and JavaScript.
This is my signature, not typed text. If you want to create your own, go to the discussion homepage here and click on “Change your signature” at the near-bottom of the page.
- WindOctahedron
- Scratcher
1000+ posts
Disable Sprite Draggability When Project is Running
Okay, this has been implemented in 3.0. Let's close this.
The message above may contain wrong information, rude remarks, or something embarrassing to my current self. In this case, please ignore it and remember that I likely wrote it back when I didn't know what “respect” truly meant. I really hate thinking about it again.
- Discussion Forums
- » Suggestions
- » Disable Sprite Draggability When Project is Running