Back To The Future with Drag-&-Drop

For discussion of xTalk topics related to education.
Post Reply
User avatar
richmond62
Posts: 3328
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 529 times
-
This was part of an Edmark CD-Rom called "Sammy's Science House":
-
sammy.gif
sammy.gif (32.23 KiB) Viewed 518 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: 3328
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 525 times
-
Attachments
SORTING.oxtstack.zip
(52.66 KiB) Downloaded 29 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3328
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 524 times
-
s3.png
s3.png (135.91 KiB) Viewed 524 times
-
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3328
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 523 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: 3328
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 522 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 520 times
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 3328
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 27 times
https://richmondmathewson.owlstown.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest