×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

simple drag drop "puzzle"

simple drag drop "puzzle"

simple drag drop "puzzle"

(OP)
Hi, I am trying to do a really simple puzzle.

There are ten sentences, each with a one word answer. These words are in a random order at one side of the screen. The user drags the correct answer to a box at the end of each sentence.

The right box produces "well done" etc etc, and snaps into place.

I've done this before with four pictures being dragged to the correct box to match the correct name and it worked no problem! I've copied the code over and altered it and the cast members but getting a problem with the "target_Sprite" line

I'm ok at reading code but am really stumped on what to do, my lingo knowledge is v limited.

Can anyone give me a VERY simple explanation and detailed instruction? Please!

Thanks

Here is my code...  

on mouseDown me
  my_sprite = me.spriteNum
  offset = sprite(my_sprite).loc - the clickLoc
  repeat while the stilldown
    sprite(my_sprite).loc = point(the mouseH, the mouseV) + offset
    updateStage
  end repeat
end

on mouseUp me
  solution = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  my_sprite = me.spriteNum
  target_Sprite = getAt(solution, my_sprite - 10)
  correct_x = sprite(target_Sprite).locH
  correct_y = sprite(target_Sprite).locV
  dist_x = abs(sprite(my_Sprite).locH - correct_x)
  dist_y = abs(sprite(my_Sprite).locV - correct_y)
  put dist_x
  put dist_y
  if (dist_x + dist_y < 149) then
    sprite(my_Sprite).loc = point (correct_x, correct_y)
    sprite(187).visible = TRUE
    go to frame 198
    updateStage
  end if
end

RE: simple drag drop "puzzle"

First of all your "words" must be in the Sprite channel 11 - 20, and your boxes must be in the channels 1 - 10.

Kenneth Kawamoto
www.materiaprima.co.uk

RE: simple drag drop "puzzle"

(OP)
thank you so much!!

I try not to get really annoyed by fact it's always the simplest solution :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close