This video, will show you howto use the saved data in your liststo replace stamps that have been cleared.
Click on the clear button to clear the stampsand then follow the rest of this video to make it work.
First, program the sprite to go tothe first location in the list.
Drag out the glide block.
This block will move the sprite to a specific position.
Type zeroes in the boxes next to X and Y,then click on the block.
It should move to (0,0) which is the center of the stage.
Then, move the arched sprite back to where it should start.
To move to the X and Y position from the list,place the item of block in the X box.
Click the dropdown to make sure it referencesthe X location of the list, not the Y location one.
Then, place another item of variable in the Y box.
Click the dropdown to make sureit references the Y list this time.
Click on the block.
The arch should go to the first location.
Place a stamp block under the glide blockto make the sprite stamp itself.
Return the sprite back to the tool box.
But that code made the sprite go to the first positionon the list and stamp then it stopped.
Next, you will code this so thatit goes through the entire list.
To easily make your program repeatthe same action over and over, use a repeat loop.
Place a repeat loop around the glide and stamp blocks.
Next, program the loop to run the correct number of times.
The number of times this loop runsshould equal the number of items on your list.
To make the loop run the correct number of times,use the length of block.
It doesn't matter whether you use the X or Y listas they both contain the same number of items.
Run the code.
Since there are two items in this list,the sprite should move to specific spot and stampthen move to a second spot and stamp.
But, it doesn't seem to be doing that.
It just goes to the first place and stops.
Click the clear buttonand return the sprite to the tool box.
The sprite is going to the X and Y of item one,or the first item of the list.
The first time the loop runs,the sprite should stamp the first location.
The second time, the second location, etc.
To keep track of how many timesthe code has gone through the loop, add a variable.
Click make a variable.
This variable will count code loops,so call it something that makes sense like count.
Place the variable count inside the boxfor which item of arch X to look at.
Then, do the same for arch Y.
Each time the code goes through a loop,the count should go up, so put thechange count by one block under the stamp block.
Click on the code to see if this works.
The sprite should go to the first spot, then the second one.
Wait a minute!
The sprite goes to the middle!
In this case, the sprite never even stamped there!
Then it stamped in the first locationand missed the second one entirely!
Take a closer look at the count.
It starts at zero, but there is no item zero on your listso the sprite just went to the coordinates (0,0)
or the middle of the screen.
In order to make sure the countis always one the first time the loop runs,place the set count to one block above the loop.
Clear the screen again, now try the code loop again.
This time, the sprite should stampin the first location, then the second one.
Drag the sprite back to the other sprites.
To avoid performing this action every time,place a go to XY block after the loop.
Test the code.
The sprite should return to thestarting point after stamping.
Finally, create a button that recreates the picture.
Choose a sprite from the library.
Add a when this sprite is clicked block.
Under it, place a broadcast and wait block.
Broadcast a new message called arch.
Finally, place a when I receive blockabove the code that recreates the picture.
Do this for each of the sprites.
Each sprite needs its own X and Y listto broadcast messages.
To hide to the lists, click the checkboxnext to them in the data menu.
Now it's your turn.
Place the stamp in the correct positionusing the repeat loop and the length of block,keep track of the times the codehas run the loop with a count variable,make the sprite glide to the positionof each previous stamp using theglide and item of lists blocks and the count variable.
Choose an Add-On
Falling Blocks (Part 1 of 2)
Create a game in which users create a building using falling blocks.