Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 12:19 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Please help with drag and drop 'sequencer'.
PostPosted: December 13th, 2008, 8:47 pm 
Offline

Joined: December 12th, 2008, 8:14 pm
Posts: 4
Evening all,

I am currently making a quiz and one of the types of answers is a 'put the below items in the correct sequence'. I.e:

--
"Please put the following in order to make a sentence"
Rainy
Its
Day
A

--

Its
A
Rainy
Day

--

I have tried with 5 frames, each can accept objects. I then have five labels that can be dragged. These will initially sit in their corresponding frames, but I wish to mix them up so they are in a random wrong order. How would I go about programming/opusly changing the frame they are dropped in?

Also, I need to be able to drag one label over another label and the two will swap positions. Is that possible?

And finally, I need to be able to get something back that will let me know what order those items are in? For example, when dropping an object into a frame, how can I determine which frame it is?

Look forward to hearing back from you,

Regards,
Dan


For this message redstork has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 17th, 2008, 9:56 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Red,

I think what you've outlined might be 'doable', but there may not be just one, easy path to achieving it.

In OpusScript you can use objectA.GetXPosition() etc., etc., -- to record the starting location of the object to be dragged. You'll use that later to Move objectB back to objectA's original position.

Once you detect an object dropped, you can run through your game logic. Then Move or SetPosition of object you want to swap out of the dropzone frame. I think this is not a trivial task to generalize.

For 'randomizing' you could use Arrays. They are pretty easy to manipulate since their elements are referred to by their index number.

if you did not mind 'simplifying' the approach, you could have your five text objects in the 'wrong order'... and let the user manually drag those out to another larger dropzone that could be used as a whitespace. Then the user drags a text phrase back to one of the five dropzone frames that are open. Then you simply have to monitor correct configurations. (see next reply)

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 17th, 2008, 10:10 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Some ideas for streamlining phrase and sentence setup.

Look up Arrays, and also the split() command. (search forum for 'split').

"some ideas * for streamlining * phrase and * sentence setup"
If you entered that string into a variable, then the split operation can load an Array for the 4 phrases (using separator above).

You could randomize the initial display 'order'.
For example arrayphrase[3] arrayphrase[2] arrayphrase[0] arrayphrase[1]

( you could have regular variables, e.g. textA, textB, textC... etc be displayed in the textobjects that are dragged/dropped. You just set Array elements to match up in 'not correct' order)

and the correct order will always be ... [0] [1] [2] [3]

- - - - - - -
I would think that approach could scale easily to larger sentences.

Good luck.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: December 17th, 2008, 10:23 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Dan,

The process is quite straightforward but to code this is a little more complex.

Basically, get the position of the object on mouse-down. On mouse-release (click) check if the object is intersecting with an other object in your list. Get the positions of both these objects and swap them around. Add to this the need to track where they are in the list - you'd need to either use OOP or variables.

To randomise the positions at the start, simply get the positions of each object and read this into an array and then use an array shuffle function - there are some already posted. Then set the new positions with a move speed of zero as the page shows.

The outcome is a very professional quiz style question. See our IKIQ exemplar for an illustration of how this would look using a vertical arrangement system.

http://www.interaktiv.co.uk/index.php?o ... Itemid=151

Regards,

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 1st, 2009, 2:43 pm 
Offline

Joined: December 12th, 2008, 8:14 pm
Posts: 4
Hi, I used the IsObjectIntersecting method as you suggested. Worked brilliantly. Basically I had 5 buttons going down vertically, one after the other. Each of those buttons had a variable I.e. QUIZ_ANSWER_1, QUIZ_ANSWER_2... QUIZ_ANSWER_5.

When I dropped the item I checked which button it was intersecting (if any) and then did a simple bit of code to swap the variable content around.

I.e. I dropped Button 1 on Button2, I'd copy Button 2's variable into a temp variable, assign Button 1's variable to 2 and then assign the temp variable content back to Button 1's variable.

Very simple really!

Thanks for the help.


For this message redstork has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Please help with drag and drop 'sequencer'.
PostPosted: March 25th, 2013, 5:08 pm 
Offline

Joined: March 25th, 2013, 4:53 pm
Posts: 14
Opus: Opus Pro v8.10
OS: Windows XP SP3
Hi,

redstork can you be more specific with the code that you used and help me?
Because I'm having problems in put what you said in practice.

Regards.


For this message pnrf has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re:
PostPosted: March 26th, 2013, 2:08 pm 
Offline

Joined: March 25th, 2013, 4:53 pm
Posts: 14
Opus: Opus Pro v8.10
OS: Windows XP SP3
mackavi wrote:
Hi Dan,
On mouse-release (click) check if the object is intersecting with an other object in your list. Get the positions of both these objects and swap them around. Add to this the need to track where they are in the list - you'd need to either use OOP or variables.


I didn't understand this part, can you clarify me? I have something like this:
Code:
// in the object
var ans = getPosition();
var PosX=ans.x
var PosY=ans.y
// mouse click
var test = Answer1.IsObjectIntersecting(Answer2); // I make a example without a list
Answer1.getPosition();
Answer2.getPosition();

// swap objects
var temp = Answer1;
Answer1 = Answer2;
Answer2 = temp;

... And?

I should make this in each object? And is something like above or not really. I need to solve this problem as soon as possible, if someone can helps.

Thanks.


For this message pnrf has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Re:
PostPosted: March 27th, 2013, 12:38 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
pnrf wrote:
I should make this in each object? And is something like above or not really. I need to solve this problem as soon as possible, if someone can helps.
Pedro,
You probably will not get a response from the original poster (at least not quickly), since that was back in 2009.

Also, is it correct to say forum readers can skip over your request in this thread, and pick up the help/discussion over in your separate Post? Clarifying this so we can all stay on the same page so to speak.
viewtopic.php?f=6&t=5025

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Please help with drag and drop 'sequencer'.
PostPosted: March 27th, 2013, 12:45 pm 
Offline

Joined: March 25th, 2013, 4:53 pm
Posts: 14
Opus: Opus Pro v8.10
OS: Windows XP SP3
Just because I didn't want to create another topic for the same discuss.
However I will write it in other page.

Thanks.


For this message pnrf has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group