![]() ![]() Set dx to x position of ball - x position of myself.Create a couple of loose x position of myself blocks.Add a new variable called dx (it means "difference in X") using a Set number dx variable block.Luckily, we know the X and Y positions of each. Now we need to measure the distances between the big spiky ball and the bloon in the X and Y axes. Remember we said the tag "Ball" was important? This is where we use the tag to find the ball. This is a good time to look for things, because we know they must exist. We start the level only when everything has been properly created. If we tried to get the ball before it was created, our code would fail. Why use When the level starts instead of When created, as we did for the big spiky ball? Well, we don't know which order game objects will be created. Set ball to a first instance by tag "Ball" sensing block.Add a new property called ball using a Set instance ball property block.Create a When the level starts event block.Get Big Spiky Ballįirst, we will need a reference to the big spiky ball. If it's less than a certain amount, this bloon will pop. We're going to measure the distance to the big spiky ball. Edit the script, and name it something useful like "Bloon". Now add various bloons all around the level.Īdd a new script to one of your Bloons. Arrange it underneath the Big Spiky Ball layer. Add BloonsĬreate a new layer called Bloons. We will use the Pythagorean Theorem to measure distances and tell whether your big spiky ball is touching a bloon. In this chapter, we'll add some bloons for you to pop. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |