Dragging the Screen with Mouse and Touch

Index

Stats

7,593 visits, 21,688 views

Translations

This tutorial hasn't been translated.

Tools

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:

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!