⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hangmancanvas.java

📁 很有趣的著名游戏Hangman
💻 JAVA
字号:
/* * File: HangmanCanvas.java * ------------------------ * This file keeps track of the Hangman display. */import acm.graphics.*;public class HangmanCanvas extends GCanvas {	private int count = 0;	public void drawHangman(){		if(count == 0) createRope();		if(count == 1) createHead();		if(count == 2) createUpperArm();		if(count == 3) createLowerArm();		if(count == 4) createHip();		if(count == 5) createLeg();		if(count == 6) createFoot();		count++;	}private void createFoot() {		// TODO Auto-generated method stub			}private void createLeg() {		// TODO Auto-generated method stub			}private void createHip() {		// TODO Auto-generated method stub			}private void createLowerArm() {		// TODO Auto-generated method stub			}private void createUpperArm() {		// TODO Auto-generated method stub			}private void createRope() {		// TODO Auto-generated method stub			}private void createHead() {		// TODO Auto-generated method stub			}/** Resets the display so that only the scaffold appears */	public void reset() {		this.removeAll();		createScaffold();		createBeam();		count = 0;	}private void createBeam() {	// TODO Auto-generated method stub	}private void createScaffold() {	// TODO Auto-generated method stub	}/** * Updates the word on the screen to correspond to the current * state of the game.  The argument string shows what letters have * been guessed so far; unguessed letters are indicated by hyphens. */	public void displayWord(String word) {		add(new GLabel(word),getWidth()/8, getHeight() * 3 / 4);	}/** * Updates the display to correspond to an incorrect guess by the * user.  Calling this method causes the next body part to appear * on the scaffold and adds the letter to the list of incorrect * guesses that appears at the bottom of the window. */	public void noteIncorrectGuess(char letter) {		/* You fill this in */	}/* Constants for the simple version of the picture (in pixels) */	private static final int SCAFFOLD_HEIGHT = 360;	private static final int BEAM_LENGTH = 144;	private static final int ROPE_LENGTH = 18;	private static final int HEAD_RADIUS = 36;	private static final int BODY_LENGTH = 144;	private static final int ARM_OFFSET_FROM_HEAD = 28;	private static final int UPPER_ARM_LENGTH = 72;	private static final int LOWER_ARM_LENGTH = 44;	private static final int HIP_WIDTH = 36;	private static final int LEG_LENGTH = 108;	private static final int FOOT_LENGTH = 28;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -