GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2009-05-26 16:03:51

edy
Member
Registered: 2009-05-26
Posts: 8

AIR BALLON HELP

:(This script will not work....
what i need is to be able to click on my air balloon...
and drag it any where i want to drag it.
Need help
Thanks
sad

From Edy
edy@gwi.net


/*
**  Usage:
**      move_to_mouse()
**
**  Arguments:
**      none
**
**  Returns:
**      nothing, but moves the calling instance
**      to the position of the mouse
**
**  GMLscripts.com
*/
{
    x = mouse_x;
    y = mouse_y;

Offline

#2 2009-05-26 16:26:30

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: AIR BALLON HELP

Here's a simple drag-able object:

Expand// CREATE
drag = false;
dx = 0;
dy = 0;
Expand// STEP
if (drag) {
    x = mouse_x + dx;
    y = mouse_y + dy;
}
Expand// MOUSE LEFT PRESSED
drag = true;
dx = x - mouse_x;
dy = y - mouse_y;
Expand// GLOBAL MOUSE LEFT RELEASED
drag = false;

Abusing forum power since 1986.

Offline

#3 2009-06-06 23:57:50

edy
Member
Registered: 2009-05-26
Posts: 8

Re: AIR BALLON HELP

whistle
i do understand that the four sections of that code go into the
Create, Step, Mouse Left Pressed, and Global Mouse Left Released
events

the whole script will not work

Code:
// CREATE
drag = false;
dx = 0;
dy = 0;


Code:
// STEP
if (drag) {
    x = mouse_x + dx;
    y = mouse_y + dy;
}


Code:
// MOUSE LEFT PRESSED
drag = true;
dx = x - mouse_x;
dy = y - mouse_y;

Code:
// GLOBAL MOUSE LEFT RELEASED
drag = false;

whistle

Offline

#4 2009-06-07 00:40:08

xot
Administrator
Registered: 2007-08-18
Posts: 1,239

Re: AIR BALLON HELP


Abusing forum power since 1986.

Offline

#5 2009-06-07 11:16:47

edy
Member
Registered: 2009-05-26
Posts: 8

Re: AIR BALLON HELP

ohmy  i must of put something under the code script

wink   xot
thanks for your help i will be making puzzles,
from the photos i take, in my state Maine.
when i get done, i will send you the puzzles.
don't no if you ever been to Maine or not,
but you will see some great photos by putting
the puzzle together.
thanks again have yourself a Sun Shinny day
From Darcy / Edy
cool

Offline

Board footer

Powered by FluxBB