I don't know when I first discovered Orisinal—it
was probably about a year ago. 'Cats'
was the first game I played and I loved it! The cats were just so...cattish!
Anyway, I'm glad I had to do this game analysis for class, because, in more
carefully reading the instructions, I discovered I'd been playing the game
wrong the whole time! With that in mind, let's get started.
Starting from the beginning, there is a credit screen. If you sit long enough (something like 10 seconds), it will automatically advance to the next screen, which is instructions, or you can click to speed the process. Both the credits and instructions fade in from black.
How it works: The opening screens must consist of white text on a black background. There is probably a tween used to cause the fading effect, which is initialized either by a timer or a click on the screen, whichever comes first
A gray box appears behind the start button when you mouse over it.
This is probably merely a button with 2 states.
The cats and all the game elements also fade in from black.
If I were making this, rather than try to make every element on the screen fade in, I'd have one giant black square overlaying everything, which I'd have fade out. For ease, and for minimal need for ActionScript programming, I'd build the fade-out into the square's timeline, and just use ActionScript to remove it from the stage after it was fully transparent.
The time bar is at the top left. The score is at the top right. There are 6 horizontal rows of cats.
The time bar is probably a static rectangle enclosing a scripted rectangle. The score area is dynamic text. The six horizontal rows are probably six rectangles positioned one below another. Being rectangles allows them to be filled with gray later on. The cats are positioned one at the bottom of each rectangle. Since there's the same number of rectangles as cats, my guess is that the cats and rectangles are each stored in arrays, and they are positioned onscreen based on their position in the array.
The time bar shrinks at a regular pace, indicating the amount of time remaining.
Time is probably calculated by use of a timer. Every time the timer goes off, a certain amount is probably shaved off the total time remaining, and the width of the bar is updated to reflect the new time. However, if you gain points, you also gain play time, so the time remaining must be updated at the end of every scoring period.
The cats, once positioned, walk from one side of the screen to the other. When they walk off one side, they appear on the other and continue their walk. If you mouse over one of them, its state changes—if it was walking, it sits down; if it was sitting, it starts walking. Periodically, the cats will change states on their own.
The cats are probably all defined by a class. When first placed on the screen, they are given a random direction, probably 1 or negative 1, which can be used in a calculation to reverse the scale of the movie clip, if necessary, and tell them whether to move left or right. The moving from one side to the other is probably accomplished by an ENTER_FRAME event listener, which positions them a few pixels farther than they were the last frame. The movement of their legs is probably a built-in timeline animation. If they walk half off the edge of the screen, they are repositioned on the other side so they can continue. The MOUSE_OVER event probably sets off a toggle function, so that if the cat is walking, it will sit, and if it is sitting, it will walk. This could be done by changing a boolean variable that gets tested every frame and stops the motion if the cat is sitting. The sitting motion itself is probably another series of frames in the timeline that can be played on demand. Interestingly, if you mouse over a cat in mid-sit, it will finish sitting before it gets back up again There must be some programmed instructions to keep the cat from starting a new action before finishing another. To get the cats to sit down and stand randomly as they do, there must be a random number generator. I suppose this could be accomplished by a timer with a random time set every time the cat changes state, or it could test for a certain number every frame—but you'd have more control with the first option.
The leader cat seems to change about every 13 seconds. It can be found in a gray box. Nothing happens if you mouse over it, but it still randomly gets up and sits down. During the interim between leader cats, you cannot do anything to any of the cats.
The “changing of the guard” occurs on a regular,
timed basis, so a timer must be reset every time the leader changes. When
the time is up, the gray fill on the former leader's box is removed. The MOUSE_OVER
event listeners are removed. A new leader is chosen, probably by a random
selection of cat in the cat array. The box of the corresponding cat is grayed
out, and all the cats get back their event listeners. An easier method than
removing all the event listeners is just to overlay the screen temporarily
with a transparent box, so you physically can't mouse over any of the cats.
Score increases when all the cats on the screen are doing the same thing (not when all the cats are walking, as I mistakenly believed). Since you can't change the behavior of the lead cat, it follows that all the cats have to be doing the same thing as the lead cat. A display appears at the center of the screen, showing how many points you've accumulated during this particular session of cat uniformity. When a cat moves, the mid-screen display vanishes and the total score display at the top right is updated.
The scoring is controlled by a document class. It probably tests, every frame, to see if the states of all the cats in the array are the same. If performing that calculation every frame is too inefficient, it could have each cat, upon changing states, call a function in the document class that updates a variable holding information about how many cats are walking. Then every time the function runs, it can test the value of the variable: if it's zero, then all the cats are sitting, and the scoring should begin; if it's the total number of cats, then they're all walking, and the scoring should also begin. Probably, this calls a function that turns on an ENTER_FRAME event listener, which adds a certain number of points to a subscore (different from the game's total score) every frame. Scoring will continue until one of the cats changes state, and then scoring should stop. At this time, the subscore will be added to the total score. You gain play time when you score points, so the amount of time earned is then added to the time remaining, and the time bar is resized accordingly.
Every once in a while, the number of cats increases to make the game more challenging.
The change is directed by a timer that goes off after a specified time: according to my calculations, every two minutes, 15 seconds. At this time all the cats stop responding to the mouse, and the screen fades out and back in with a new row. Again, this could most easily be effected by overlaying the screen with a big black box that fades in to full black. When the box has made everything beneath it invisible, then the number of cats and boxes in their respective arrays can be increased, everything can be repositioned, and the game can essentially restart, except that your score and time remaining do not change. I got up to 10 rows of cats before I lost. I'm not sure if they game would continue adding rows after this. Eventually it would have to stop, because the rows would get too narrow to accommodate a whole cat.
I don't think there is a way to win, but when you lose, the cats disappear and a game over screen fades in. The screen tells you your final score and your previous high score and has a Play Again button that restarts the game
The fade effect is probably accomplished the same way it was accomplished for all other game events. The total score is the same score that you've been accumulating the entire game, held in a number variable. The previous high score must be stored in a cookie. I don't know if Flash can set cookies, but the Flash game could communicate with an HTML page to tell it to check for a previously set cookie, and then tell it to set a new one if the new score is higher than the old one. As I learned from the Invaders game, Play Again buttons are a pain in the butt. This one has to remove all the cats and boxes from the stage, remove all their event listeners, change the score to zero, reset the time remaining, go back to the first gameplay frame and then add 6 cats and boxes to the stage, and fade in.