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
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