Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Tue 19/01/2010 09:52:54

Title: Drag and Drop objects to rearrange anagram
Post by: barefoot on Tue 19/01/2010 09:52:54
Hi

I have looked for an object function/event in the manual etc that will allow user to move objects around via the mouse, but to no effect, as yet.

Basically there is an anagram, which you rearrange until you find the correct phrase, no other action is required.

12 letters (objects) make up the 2 word phrase

all help appreciated

barefoot
Title: Re: Drag and Drop objects to rearrange anagram
Post by: Lufia on Tue 19/01/2010 10:07:11
The IsButtonDown funtion will be useful for this.
Basically, you'd set an object coordinates to mouse.x and mouse.y while the mouse button is pressed.

I haven't thought about this in detail, I just hope I can help you get on the right track.
Title: Re: Drag and Drop objects to rearrange anagram
Post by: Calin Leafshade on Tue 19/01/2010 10:32:04
Yeah like lufia says.

just bind the object's x and y to the mouse. To make it even more appealing to the eye have an offset value equal to the position of the mouse on the object when the mouse is first held down. so the object doesn't 'snap' to the mouse.

Store the original value too so that if the mouse is released somewhere it shouldnt be you can snap the object back to its original location.
Title: Re: Drag and Drop objects to rearrange anagram
Post by: barefoot on Tue 19/01/2010 12:16:39
cheers all

thanks

barefoot
Title: Re: Drag and Drop objects to rearrange anagram
Post by: Ryan Timothy B on Wed 20/01/2010 03:07:58
Here's an object drag script if you need any assistance.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35002.msg458179#msg458179