Java applet ahorcado
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package casita;
import java.awt.*;
import java.applet.*;
// TODO start asynchronousdownload of heavy resources
/**
*
* @author Gabriel
*/
public class La_Horca extends Applet{
final int maxTries = 1;
/* This is the maximum length of a secret word. */
final intmaxWordLen = 10;
/* This buffer holds the letters in the secret word. */
char secretWord[];
/* This is the length of the secret word. */
int secretWordLen;
/* This bufferholds the letters which the user typed
but don't appear in the secret word. */
char wrongLetters[];
/* This is the current number of incorrect guesses. */
intwrongLettersCount;
/* This buffer holds letters that the user has successfully
guessed. */
char word[];
/* Number of correct letters in 'word'. */
int wordLen;
/* This is thefont used to paint correctly guessed letters. */
Font wordFont;
FontMetrics wordFontMetrics;
/* This is the sequence of images for Duke hanging on the gallows. */
ImagehangImages[];
final int hangImagesWidth = 39;
final int hangImagesHeight = 58;
// Dancing Duke related variables
/* This thread makes Duke dance. */
Thread danceThread;
/*These are the images that make up the dance animation. */
Image danceImages[];
private int danceImageWidths[] = { 70, 85, 87, 90, 87, 85, 70 };
/* This is the maximum width and height ofall the dance images. */
int danceHeight = 68;
/* This variable holds the number of valid images in danceImages. */
int danceImagesLen = 0;
/* These offsets refer to the danceimages. The dance images
are not of the same size so we need to add these offset
in order to make the images "line" up. */
private int danceImageOffsets[] = { 8, 0, 0, 8, 18,...
Regístrate para leer el documento completo.