Search Tutorials
Introduction As you can probably guess this code has a number of applications. The first that comes to mind is a an asteroid field but don't let your imagination stop there. So let's have a look at it. There is a tiny bit of code on the main timeline. This will set how many circles will appear on the screen among other things. Comment: ---------------------------------------------- Comment: variable definitions Comment: ---------------------------------------------- Set Variable: "total_circles" = 5 Set Variable: "movie_width" = 550 Set Variable: "movie_height" = 400 Set Variable: "speed" = 3 The rest of the code is inside the circle and there is only ONE circle. The rest of the circles are separate instances of the original. The Concept After initialisation the circles check to see if they've collided with a wall, then they check to see if (after they move their alloted movement for this turn) if they will be in collision... then they move themselves. Since this code is replicated as many times as you put instances of the circle on the movieboard (except I have only set 5 colors) you can scale the circle, etc, and the code will still work.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|