Juggler's method pulls you out of that entertainers mode and puts the pressure on the target by asking really broad open ended questions. You build rapport/comfort by finding commonalities from her answers and escalate quickly through the interaction. Hey monkey, I have a question. Does Juggler method really assume attraction before you even open? Another famous Juggler technique is the vacuum. A way of putting the onus on the woman to open up and contribute to the interaction. Overall Juggler's method is based around creating an intimate vibe, deep rapport on a wide range of topics while gaining compliance from the woman (getting the woman to put effort into the interaction).
This time, I want you to show how the juggler works and how you can use this simple tool to be the master of your animations. This topic comes up quite often in the forum, so I thought a detailed explanation might help a lot of you.
In reality, tweens and jugglers are very simple objects. If you understand how they work, you can handle all time-based stuff in your games very elegantly.
Tweens, inside out
Before we look at the juggler, however, we need to understand how tweens work internally. Let’s look at the security door tween we’ve created the last time:
Notice that I did not add the tween to the juggler - we want to manipulate the tween manually in this sample. Look at this:
As you can see, every time I call the method “advanceTime:” on the tween, it updates the door’s y-value. There’s no magic behind a tween - all you have to do is call the “advanceTime:” method regularly (read: once per frame).
I guess now you see where I’m going. In theory, you don’t need a juggler at all - you could create an enter frame event listener and update your tween once per frame, like this:
In reality, however, that’s burdensome. Work like this should be delegated to a cheap assistant that does not ask any dumb questions - and that’s why you hire the juggler for that job! :-)
A custom juggler
If you use the stage juggler (accessible to any display object by calling “self.stage.juggler”), you just have to add the tween to the juggler, and it will carry out the animation for you. We demonstrated that in the last part of this series. However, we won’t use the stage juggler now, but create our own juggler.
But why? I’ll tell you a secret: I rarely use the stage juggler. In my games, I always create my own jugglers. On the long run, that makes life easier. You will see why that is at the end of this tutorial.
The juggler is a really small class. It does one thing, and one thing only: advancing all tweens you give it. Look at this:
However, the door won’t move yet! Just like the tween, the juggler needs to be advanced:
Bummer. We have not gained much, have we? That’s just as much work as before!
Well, in this simple example, the juggler really does not help much. But in a typical game, you have a lot of animations, and then it suddenly makes sense. We’ll see that later.
BTW, have you noticed the “isComplete” property of the tween in the code above? That information is crucial to the juggler, because it tells the juggler when an animation is finished. As soon as that happens, the juggler can throw away the tween.
A real life example
Let’s look at an example that comes closer to real life.
When I create some building block of my game that is bound to become more complex, I always start with a scaffold like this:
It’s just a sprite with a juggler and a method that is supposed to be called once per frame. This class will become the playing field, a typical building block of a game. I might also have a class “Dashboard” (showing the health and number of lives of the player) and a class “MessageBox”. All those major building blocks have some animations, so they all look start like the class above.
Whenever an animation is started from within those classes, I add the corresponding tweens to its juggler (mJuggler). Thus, the animations of each class are all separated.
Now somebody has got to handle those classes! That’s the stage, normally. Look at this:
Now we get to the point where it all comes together. The reason that all those classes have their own juggler is that we want to control them separately! Look at the “onEnterFrame:” method. As long as a message box is active, the playing field will not move one pixel. It’s, in effect, frozen where it is! As soon as the message box has disappeared (it’s nil), it continues where it left of. The dashboard, however, is animated continuously.
To see why this is so useful, look at the alternatives. Say you had used one juggler (probably the stage juggler) for all animations. Now the user hits the pause button. How in hell do you stop all animations? You’d have to remember each and every tween and remove it from the stage juggler. Then, when the game continues, you’d have to add them again. That’s a lot of work! Besides, I guarantee that you’ll forget one tween sometime, perhaps creating a hard to find bug.
Best practices
Thus, my recommendation is to construct your games just like the sample above:
- Create separate classes that constitute the main building blocks of your game.
- Give each of those classes their own juggler.
- Create an enter frame event listener in your stage class and let it be responsible for advancing the animations of your building block classes.
Another interesting trivia about the juggler is that it can handle more than just tweens. Every class that implements the “SPAnimatable” protocol can be added to a juggler. I already demonstrated that in this blog post.
That’s it for today! Be sure to check back here soon, when we have more tips on how the juggler can make your life simpler.
We have all seen, at least once in our life, a juggler tossing balls in the air. Why is that so impressing at our eyes?
Despite having just two hands, any respectable juggler can juggle three balls at the same time. Considering for simplicity that one can handle one ball for each hand, how is that possible?
Let's try to analyze Animation 1. We can see that each ball is tossed by one hand to the other: the right hand tosses the balls to the left hand and vice versa. Just as the floating ball floating is about to fall down, the juggler tosses another ball up to free his hand and catch the falling one. Juggling three or more balls is possible only by iterating this principle.
The pattern represented in Animation 1 is known as three-ball cascade. Let's analyze now Animation 2 and compare it with Animation 1.
In this case we immediately note that the number of balls is still 3, but the pattern is different. Indeed, by observing it carefully, we see that the juggler tosses the three balls at three different heights.
As you can easily imagine, there is a wide variety of patterns and, if we were to assign a name to each pattern (as in the case of the cascade), we would have to make a prohibitive effort of memory.
For this reason Paul Klimek and Don Hatch, at the beginning of the 80s, independently invented a notation system to describe and name juggling tricks nowadays called siteswap. Afterwards, this system has been developed and extended by other jugglers, like Bruce Tiemann, Jack Boyce and Ben Beever.
Siteswap is able to describe (and name) all juggling patterns with any number of jugglers and balls, covering both the case of synchronous and asynchronous throws. In the following two animations we can see the same pattern done in both the asynchronous and synchronous versions.
The Juggler Method
(NOTE: some patterns can be only asynchronous while others can be only synchronous).
Synchronous
For simplicity, we will describe the so-called Vanilla siteswap. This siteswap notation allows us to describe all the patterns where the balls are tossed asynchronously by a single juggler using both hands.
Before going through the description of this notation method, we must underline that siteswap has a limitation. Let's observe the following two animations.
Cascade
We have seen already the left-side animation: the three-ball cascade. The right-side pattern, known as three-ball Mill's Mess, is still a cascade but it's done by crossing and switching the hands' position alternatively. Even though the two patterns look very different, they have the same siteswap notation, i.e. they are identical. Indeed, if we focus on the trajectories of the balls with respect to the positions of the hands, we see that Mill's Mess is identical to the normal cascade.
Therefore, siteswap is able to describe juggling patterns by considering the height and the direction in which the balls are tossed (a ball can be tossed to the same or to the other hand) but without considering 'how' the pattern is executed.
After this quick introduction, we will now describe how siteswap works. The basic idea is very simple: we assign a positive integer number to each throw that corresponds to the number of beats (soon we will deepen this concept) that the ball takes to complete his trajectory. We use odd numbers (1, 3, 5, ...) for throws from one hand to the other hand and even numbers (2, 4, 6, ...) for throws from one hand to itself. The number zero (0) is used to indicate when one hand is not holding balls during a beat.
In other words:
- A 0 means a beat when the hand is empty.
- A 1 means a direct throw from one hand to the other, during which there is no time to catch or throw other balls, i.e. it is executed in one beat.
- A 2 means a very small throw (almost imperceptible) of a ball to the same hand. While the ball is completing its trajectory, the hand who tossed it has no time to do anything else while the other one has a beat to catch and throw another ball.
- A 3 means a throw from one hand to the other during which both have a beat to juggle a ball each (so there is time to juggle two other balls).
- A 4 means a throw from one hand to the same hand during which the tossing hand can juggle another ball while the other hand can juggle two balls (so there is time to juggle other 3 balls).
- ...
Therefore, the numbers indicate the height at which the balls are tossed relatively to the execution speed of the throws. Indeed, it is possible to toss a 5 with top height under our head if we juggle quickly, or over 3 meters if we juggle slowly. What really matters are the beats left to juggle other balls during the trajectory of the toss. This depends, of course, by the speed of the juggler.
Furthermore, as it is easy to guess from the animations above, the patterns are repeated cyclically. In other words, there is a period after which the pattern is repeated (identically or symmetrically). With the siteswap notation we only write the throws that identify the period of the pattern. For example, the period of 531531531 is 531. We refer to it as 531 by removing the redundant part and without loosing any information.
Once the concepts detailed above are clear, we can try to recognize some patterns:
3
423
4
5
753
Once we are familiar with the concept of siteswap we can go through a little bit of theory. Let's try to imagine the pattern 432. First, say with the right hand, we toss a 4, i.e. the ball will falls in the same had. Then we toss a 3 with the left hand, i.e. the ball will fall in to the right hand. While the two balls are still completing their trajectory, the right hand executes a 2, in other words it performs a small toss to itself. What will happen is that the right hand will find itself with three balls falling on it at the same time. In siteswap jargon this event is called collision, and the pattern is impossible to repeat. Indeed, the sequence 432 is not executable.
How can we distinguish an executable sequence from a non executable one? Fortunately maths comes to the rescue! Indeed, there is a theorem that characterizes siteswaps and gives us a condition such that there are no collisions.
Characterization theorem of siteswaps
A finite sequence of non-negative numbers (where is the number of digits) is executable if
for each .Here, the operator returns the remainder of the division
Let's come back to the previous example and verify, using the theorem, that the sequence 432 is not valid:
In this case we get 2 for every digit of the sequence and, according to the theorem, this is not a valid siteswap. We now try to apply the theorem to a valid siteswap that can be obtained by switching the last two digits of the sequence above: 423
The Juggler Method
It is clear that this siteswap respects the condition imposed by the theorem (and you can actually find it in one of the animations above).
Suppose now to have a valid siteswap, for example 534, How many balls do we need in order to execute it? Again we have another nice and helpful theorem used by the jugglers from all over the world.
Theorem on the number of balls
If is a valid siteswap (where is the number of digits), then we have that
Let's try how many balls we need for the 534 pattern:
The answer is 4 balls!Do you think that those patterns are science-fiction? Try to watch the following video by Ofek Snir, a great juggler that executes (among other stuff) some very hard siteswap with 7 balls.
As already specified above, this article only talks about the Vanilla siteswap. Actually there are also siteswap notations to represent other categories of patterns such as synchronous, the patterns where one hand can hold and toss more than one ball at time (in jargon multiplex) and the ones executed by more than one juggler (in jargon passing). Here are some examples
Multiplex: [53][32]2
Passing: < 4|4|5p1 >< 5p2|5p1|3 >< 4p3|3p3|3p2 >