Back To The Future with Drag-&-Drop

For discussion of xTalk topics related to education.
Post Reply
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Back To The Future with Drag-&-Drop

Post by richmond62 »

Well, back to a Macintosh Performa 5200 in 1996 in Saudi Arabia and my 2 sons: 1 and 4 years old, and this:
-
Sorting_Station.jpg
Sorting_Station.jpg (108.67 KiB) Viewed 460 times
-
This was part of an Edmark CD-Rom called "Sammy's Science House":
-
sammy.gif
sammy.gif (32.23 KiB) Viewed 449 times
-
https://en.wikipedia.org/wiki/Early_Learning_House

The idea behind this exercise was for small kids to drag beasties of various categories into various rubbish bins.

Mimicking this program is a wonderful way to get one's head round OXT's drag-&-drop capabilities.

Download the original here:

https://macintoshgarden.org/games/sammys-science-house
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Back To The Future with Drag-&-Drop

Post by richmond62 »

So, let's start off with a stack with 2 rubbish bins and 6 beasties: 3 insects, and 3 non-insects:
-
s1.png
s1.png (108.25 KiB) Viewed 456 times
-
Attachments
SORTING.oxtstack.zip
(52.66 KiB) Downloaded 28 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Back To The Future with Drag-&-Drop

Post by richmond62 »

Before we get into drag-and-drop we need to set up a button to return the animal to where they started:
-
s2.png
s2.png (24.14 KiB) Viewed 455 times
-
s3.png
s3.png (135.91 KiB) Viewed 455 times
-
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Back To The Future with Drag-&-Drop

Post by richmond62 »

So that we can move an image with the mouse we give it the following code:
-
s4.png
s4.png (40.16 KiB) Viewed 454 times
-
We put the grab me code inside a mouseDown command so when we release the mouse the image stops moving.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Back To The Future with Drag-&-Drop

Post by richmond62 »

Now we have to make sure that when an image is dragged to the CORRECT rubbish bin it stays there, and when an image is dragged to the INCORRECT rubbish bin it is returned to its original location.

Here is the code for the 'ladybird':
-
s5.png
s5.png (71.09 KiB) Viewed 453 times
-

Line 6
checks if the ladybird overlaps the rubbish bin for insects.

If this is true,

Line 7 makes the ladybird invisible.

Line 8 sends the ladybird back to its start position.

If this is not true,

Line 10 sends the ladybird back to its start position.

Obviously we now have to put extra code into the RESTART button so all the animals become visible again:
-
s6.png
s6.png (148.63 KiB) Viewed 451 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3295
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Back To The Future with Drag-&-Drop

Post by richmond62 »

I am uploading the stack at this stage so that YOU can complete the exercise by yourself.
Attachments
SORTING.oxtstack.zip
(53.21 KiB) Downloaded 26 times
https://richmondmathewson.owlstown.net/
Post Reply

Who is online

Users browsing this forum: TerryL and 0 guests