Dragging the Screen with Mouse and Touch

9
  • 61 favourites

Index

Stats

11,106 visits, 29,648 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

The first thing you need to do is add an extra action to both of the events already created. When the mouse is pressed, you need to Set Value of the Global variable Dragging to 1 and when the mouse is not pressed, you need to Set Value of the Global variable Dragging to 0.

This sets up so that it will drag the screen (once we have set up the code) when the mouse is pressed and stop when the mouse is released. Now for the code to make the screen move:

Create a new event:

System, you need to Compare variable, select Dragging, = Equal to and the Value to 1.

Then, add an action:

System, Scroll to position. Set the X and Y values to:

DragScrollX+DragMouseX-Mouse.AbsoluteX

DragScrollY+DragMouseY-Mouse.AbsoluteY

There we have it, now the screen will move when you drag it with the mouse and the finished code should look like:

  • 4 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Is there a modification to the expression that can take layoutScale into account? If the scale is anything other than 1 this system breaks. I've been trying to figure this out to no avail. Your tutorial is great BTW! Cheers!

  • Thank you very much!

  • Thanks heaps! worked a treat