2017년 8월 10일 목요일

Build a Ladder Truck, then make it Go! (Part 1)


This has been replaced by part 2: Build a Ladder Truck and Make it go! where the truck can also be dragged left or right here: Build a Ladder Truck, then make it Go! (Part 2)
You can still use this for a study of drag-and-drop.
---

In Part 1, a Ladder Truck is put together by dragging the pieces to a construction area.
As the user drags the component parts, sound effects are heard.
When the pieces are dropped a familiar clicking sound is heard.
Once all pieces have been placed the red beacon light flashes.

The blocks to handle the drag-and-drop duties are handled by the purple Procedure blocks shown on the right.
They are used by each component part's TouchDown, Dragged and TouchUp event blocks.
If these reusable procedures were not used, most of the blocks on the right would need to be duplicated for each component part of the Ladder Truck (seven in all).

ImageSprites are used to hold the Pictures of each of the component parts.
These are:
⦁ Driver
⦁ Body (of the truck)
⦁ Crew (person in back seat)
⦁ Light
⦁ FrontWheel
⦁ BackWheel
⦁ Ladder
There are sound effects for each of the ImageSprites.
The sounds are played in the shared TouchDown procedure which is called by each of the component parts' TouchDown event blocks.
---
In Part 2 I will allow the truck to be dragged back and forth as the wheels roll.
---
LadderTruck.apk

--
Scott, these samples are just awesome! Thanks!

--

댓글 없음:

댓글 쓰기