What are the main features of this game? The uniqueness of this game is that it challenges the use of multiple layers and the possibilities it offers
In addition, it is breaking the principle of pure 2D doing up to demonstrate the effect of depth by letting the main character (a dog) move in and out of a field of view.
Each game consist of 10 red vinyl balls to be launched.
The ball is sent into the air from an imaginary ball throwing robot which is located behind a low shrub The dog must catch the ball behind one of three hedges. Player must take measure of the path that the ball takes in the air when shot off from the ball robot machine to determine which one of these three hedges he will run behind. If he runs blind behind the hedges he risks to loose a ball. The ball's trajectory goes deepest, longest and highest when it takes the rear hedge and shortest and lowest for the front hedge. His success criterion is to catch the ball before it hits the ground.
What contributes to the 3D experience?
First, the background (2 kinetic.rects: ground and sky) is formed with a vertical colour gradient to give depth effect.
Second, as the player moves around with dog on the canvas using the keyboard arrow keys he also let the dog decrease/increase in size to reflect the depth effect The same is true with its depth of colour (dogs opacity).
Third, depth effect is further enhanced by the shrub and the two trees changing size when the dog moves forward to the hedges and back again.And it is all the more prevalent because the low shrub and trees move in the opposite direction of the dog
Fourth, the hedges have different values of opacity. (the rear one the the most pale)
Fifth, and finally the balls fades (size, colour) during throw.
Base definitions
All characters and decoration figures in the game are defined as Kinetic class objects.
The 10 balls objects are added as elements to separate arrays. This we can reference and keep track of them at any time.
Because the dog and the balls must go between the layers in a continuous and transparent way (so as if there were no layers for the the spectator's point of view) we need to register them and manage them on the canvas field as, in this case, four completely synchronous teams. When an object (dog or ball) is active on one particular layer (opacity = 1), its mirrored twin on the other layers must at the same time be invisible (opacity = 0).
We have got 7 layers in the game
layer1 - base ground decoration (land and sky) and dog operating on terrain behind hedge01
layer2 - carrier of the rear hedge01
layer3 - dog operating on terrain behind hedge02
layer4 - carrier of the middle hedge02
layer5 - dog operating on terrain behind hedge03
layer6 - carrier of the front hedge03, the palm trees and the shrub
layer7 - dog operation topmost in front of all hedges; the palm trees and the shrub , text message box etc
Remember the absolute most essential thing: all layers are transparent if not covered with any kinetic object (representing figure, character or color ground fill). Remember also form earlier: the dog goes seamlessly across its reserved layers.
Window.addEventListener('keydown', function(e) {}), Left, Up, Down and Right Arrow Key moves the dog around with 10 px.
SPACE (=ball throw trigger) Restriction build in: player can not trigger a new ball to fire before the previous one is down
Comes at a random tree times out of ten. Half way down and before the ball disappear behind a hedge it is abruptly jabbed 25 px to the right or left. Direction, left or right, also comes a a random.
The Kinetic Animation loops mainly serve to drive the ball up the field. Which path it takes is determined as a random out of three categories: short, medium and long distance. The balls are thrown out horizontally at a random. The do go in straight lines.
When the ball on its way out has peaked, it is passed to drop vertically down in a new loop kinetic routine
In this last loop we also run detection for collusion between dog and a ball
If the test returns out positive the dog has picked up the ball which causes the dog object to carry a new image: dog with a ball.
Player leads the dog down to the centre of the target flag whereby he recovers one point
We could give the player a choice between different levels of difficulty, for example, variable tolerance margin for when the ball collides with the dog,.We could also introduce varying speed at which the ball passes into the air. We could introduce foreign characters which disturb the dog so it loses concentration
© Arrangement, April 2015, netscale.dk