ScratchData LogoScratchData
Back to s_federici's profile

CowboyPuzzle1 (with completion detector)

S_s_federici•Created June 21, 2022
CowboyPuzzle1 (with completion detector)
14
4
53 views
View on Scratch

Instructions

Press H to send all the pieces to their home position. Press S to scramble them again. Press Z to reset the home positions to the current positions. The project detects that all pieces are -almost- in the correct position.

Description

This is a remix of @goch's project https://scratch.mit.edu/projects/697462469/ to which I added a completion script. NOTE: I downloaded @goch's project and then uploaded my remix, so the remix chain is lost. Sorry. To make the completion script simple, I forced one of the pieces (the horse's paws) not to rotate. You can find an alternative completion detector (conceptually simpler, but longer to implement) at https://scratch.mit.edu/projects/706714456/ HOW TO CREATE a COMPLETION DETECTOR script (as the one you see in the "Completion detector" sprite): 1. have a sprite that cannot rotate 2. press H, so that each piece is in its final position 3. annotate the x/y positions of each sprite 4. for each pair of sprites that are in touch in the final drawing, add an IF/ELSE sub-script like the one you see in the script of the "Completion detector sprite". NOTE: it is important that the subtractions always give a positive result, so put as the first coordinate the larger one 5. calculate the x and y distances of the pair of sprites, and, in the OR operator, insert that distance minus 2 as the first value and that distance plus 2 as the second value

Project Details

Project ID707477597
CreatedJune 21, 2022
Last ModifiedSeptember 3, 2022
SharedJune 21, 2022
Visibilityvisible
CommentsAllowed