Game Development Reference
In-Depth Information
5. In the if condiion, check for touching color <black> ? or touching <edge> ? then
6. If the cat does collide with either one of those, reset it to its original posiion with a
go to x:() y:() block.
7. Fill the slots with the item <1> of <xySave> and item <2> of <xySave> block with x
and y posiions respecively.
8. If the cat didn't collide with a wall, we can save the new coordinates.
9. Set the replace item <1> of <xySave> with x posiion block.
10. Set the replace item <2> of <xySave> with y posiion block.
We could leave it at that point, because the cat is now in a new valid posiion. However, the
movement will look very jumpy this way. So we will improve that by adding a few scripts to
create fluid movement which are as follows:
1. Reset the cat to its previous posiion by seing the move (-20) steps block.
Then, we will make the glide (0.4) secs to x:() y:() block.
In the slots, we will use the freshly saved coordinates, item <1> of <xySave> and
item <2> of <xySave> :
That completes our main player control scripts. The cat sprite can be moved freely through
the corridors of the maze but it won't be able to cross a wall.
Search WWH ::

Custom Search