[Flash 10]

janvier 2011

Pac Man

Au moment où j’écris c’est encore juste une ébauche de PacMan, on peut juste tester le déplacement, les collisions et l’algo de recherche du fantôme rouge.

Quand on a des specs aussi précises c’est un juste un plaisir de les implémenter :D

Blinky The red ghost’s character is aptly described as that of a shadow and is best-known as “Blinky”. In Japan, his character is represented by the word oikake, which means “to run down or pursue”. Blinky seems to always be the first of the ghosts to track Pac-Man down in the maze. He is by far the most aggressive of the four and will doggedly pursue Pac-Man once behind him.
Of all the ghosts’ targeting schemes for chase mode, Blinky’s is the most simple and direct, using Pac-Man’s current tile as his target.

All ghosts move at the same rate of speed when a level begins, but Blinky will increase his rate of speed twice each round based on the number of dots remaining in the maze. While in this accelerated state, Blinky is commonly called “Cruise Elroy”, yet no one seems to know where this custom was originated or what it means. On the first level, for example, Blinky becomes Elroy when there are 20 dots remaining in the maze, accelerating to be at least as fast as Pac-Man. More importantly, his scatter mode behavior is also modified to target Pac-Man’s tile in lieu of his typical fixed target tile for any remaining scatter periods in the level. This causes Elroy to chase Pac-Man while the other three ghosts continue to scatter as normal. As if that weren’t bad enough, when only 10 dots remain, Elroy speeds up again to the point where he is now perceptibly faster than Pac-Man.

If a life is lost any time after Blinky has become Elroy, he will revert back to his normal behavior and speed when play resumes, heading for his home corner during the initial scatter period. But once the last ghost (Clyde) has left the ghost house in the middle of the board, he will turn back into Elroy again. Keep in mind: he is still in scatter mode the entire time.

PinkyNicknamed “Pinky”, the pink ghost’s character is described as one who is speedy. In Japan, he is characterized as machibuse, meaning “to perform an ambush”, perhaps because Pinky always seems to be able to get ahead of you and cut you off when you least expect it. He always moves at the same speed as Inky and Clyde, however, which suggests speedy is a poor translation of the more appropriate machibuse. Pinky and Blinky often seem to be working in concert to box Pac-Man in, leaving him with nowhere to run.

In chase mode, Pinky behaves as he does because he does not target Pac-Man’s tile directly. Instead, he selects an offset four tiles away from Pac-Man in the direction Pac-Man is currently moving.
If Pac-Man is moving left, Pinky’s target tile will be four game tiles to the left of Pac-Man’s current tile. If Pac-Man is moving right, Pinky’s tile will be four tiles to the right. If Pac-Man is moving down, Pinky’s target is four tiles below. Finally, if Pac-Man is moving up, Pinky’s target tile will be four tiles up and four tiles to the left.
Pinky is the easiest ghost to exert control over thanks to his targeting scheme. By changing direction, you can dictate where Pinky will turn next when he is nearby. If you are facing off closely with Pinky, he will turn before he reaches you if he can. This happens due to the fact Pac-Man has come close enough to Pinky for Pinky’s target tile to now be behind him.

InkyNicknamed “Inky”, Inky uses the most complex targeting scheme of the four ghosts in chase mode.
He needs Pac-Man’s current tile/orientation and Blinky’s current tile to calculate his final target.
To determine Inky’s target, we must first establish an intermediate offset two tiles in front of Pac-Man in the direction he is moving. Now imagine drawing a vector from the center of the red ghost’s current tile to the center of the offset tile, then double the vector length by extending it out just as far again beyond the offset tile.
Inky’s targeting logic will keep him away from Pac-Man when Blinky is far away from Pac-Man, but as Blinky draws closer, so will Inky’s target tile. This explains why Inky’s behavior seems more variable as Pac-Man moves away from Blinky. Like Pinky, Inky’s course can often be altered by Pac-Man changing direction or “head-faking”. How much or how little effect this will have on Inky’s decisions is directly related to where Blinky is at the time.

ClydeClyde: The orange ghost is nicknamed “Clyde” and is characterized as one who is pokey.
In Japan, his character is described as otoboke, meaning “pretending ignorance”, and his
nickname is “Guzuta”, meaning “one who lags behind”. In reality, Clyde moves at the same
speed as Inky and Pinky so his character description is a bit misleading. Clyde is the last
ghost to leave the pen and tends to separate himself from the other ghosts by shying away
from Pac-Man and doing his own thing when he isn’t patrolling his corner of the maze.
Although not nearly as dangerous as the other three ghosts, his behavior can seem unpredictable at
times and should still be considered a threat.
During chase mode, Clyde’s targeting logic changes based on his proximity to Pac-Man (represented by
the green target tile above). He first calculates the Euclidean distance between his tile and Pac-Man’s tile.
If the distance between them is eight tiles or more, Clyde targets Pac-Man directly just as Blinky does. If
the distance between them is less than eight tiles, however, Clyde switches his target to the tile he
normally uses during scatter mode and heads for his corner until he gets far enough away to start
targeting Pac-Man again. In the picture above, Clyde is stuck in an endless loop (as long as Pac-Man
stays where he is) thanks to this scheme. While occupying any tile completely outside the dashed
perimeter, Clyde’s target is Pac-Man. Upon entering the area, Clyde changes his mind and heads for his
scatter target instead. Once he exits the perimeter, his target will change back to Pac-Man’s current tile
again. The end result is Clyde circling around and around until Pac-Man moves elsewhere or a mode
change occurs. Clyde is fairly easy to avoid once you understand his targeting scheme. Just remember:
he is still dangerous if you manage to get in his way as he runs back to his corner or before he can reach
an intersection to turn away from you.

sources : pacman dossier

== Contrôles ==
Pour les déplacements vous utiliserez les flèches directionnelles du clavier.
1 click sur la scène réinitialise le jeu.