MMM
Member
After few days of trying and failing, I finally made a scrolling menu.
NOTE: This code is made to scroll object only Up / Down
First, create an object that will be a page of the book.
In CREATE event put:--------------------------------------------------------------
global.speed=0;
grab=0;
xx = 0;
yy = 0;
In GLOBAL LEFT PRESSED (mouse button) put:----------------------------
grab=1
yy = y-mouse_y;
xx = x-mouse_x;
y = mouse_y+yy;
x = mouse_x+xx;
In GLOBAL LEFT RELEASED (mouse button) put:---------------------------
grab=0
And in STEP event put:----------------------------------------------------------------
global.speed=distance_to_point(0,mouse_y+yy)
if grab>0
{if x>0
{x=0}
if x<768
{x=0}
move_towards_point(0,mouse_y+yy,global.speed/2)}
else
{friction=3}
if y>0 //This will stop page to exit the screen from the top edge of the room
{grab=0
y=0
speed=0}
And that's it. Now only add text in DRAW event.
I didn't manage to find any help on this subject so I wrote down how I did it (if there is a better way please tell me and the others in comments
NOTE: This code is made to scroll object only Up / Down
First, create an object that will be a page of the book.
In CREATE event put:--------------------------------------------------------------
global.speed=0;
grab=0;
xx = 0;
yy = 0;
In GLOBAL LEFT PRESSED (mouse button) put:----------------------------
grab=1
yy = y-mouse_y;
xx = x-mouse_x;
y = mouse_y+yy;
x = mouse_x+xx;
In GLOBAL LEFT RELEASED (mouse button) put:---------------------------
grab=0
And in STEP event put:----------------------------------------------------------------
global.speed=distance_to_point(0,mouse_y+yy)
if grab>0
{if x>0
{x=0}
if x<768
{x=0}
move_towards_point(0,mouse_y+yy,global.speed/2)}
else
{friction=3}
if y>0 //This will stop page to exit the screen from the top edge of the room
{grab=0
y=0
speed=0}
And that's it. Now only add text in DRAW event.
I didn't manage to find any help on this subject so I wrote down how I did it (if there is a better way please tell me and the others in comments
Last edited: