Drag and scroll

how can I make a thing where when i drag somewhere the place scrolls

Not sure that this will work, but make a sprite and call it "screen". Make the costume cover the entire screen, and set draggable off.

in it, do

when flag clicked :: control
go to x: (0) y: (0)
set [ghost effect v] to (100) :: looks
set [movX v] to (0)
set [movY v] to (0)
forever
go to [front v] layer
end
when I am [clicked v] ::control hat
repeat until  <not <<mouse down? :: sensing> and <touching [mouse pointer v] :: sensing)>:: operators> :: operators 
go to [mouse pointer v] :: 
end
set [movX v] to (x position)
set [movY v] to (y position)
for each (item) in (my [neighbors v] :: sensing) {
tell (item) to {go to x: ((x position) + (movX)) y: ((y position) + (movY))} :: control
} :: list
set [movX v] to (0)
set [movY v] to (0)
go to x: (0) y: (0)

This took me 30 minutes.
No I did not test if this would work

it didnt work :frowning:
it is supposed to be like those mobile games where there is land and when you drag you see the other parts of the island

You can basically just write a regular drag and drop system, but instead of using a sprite's position, use the camera position. I went with setting the camera to a list, to make calculations easier to write (instead of handling the x and y separately).

Here's a demo I made to showcase this in action.

https://snap.berkeley.edu/snap/snap.html#present:Username=ego-lay_atman-bay&ProjectName=draggable%20camera%20demo


umm why cant i see the blocks on firefox

It's not a firefox problem, it's a theme problem. The scratchblocks plugin doesn't work with the air theme (but that won't be an issue when the snap devs switch to my new snapblocks plugin).

instead you get to see the pain I went through to write a script that, in theory could work, purely in snapblocks off of the top of my head in biology :)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.