当前位置: 首页>>代码示例>>Java>>正文


Java Input.KEY_3属性代码示例

本文整理汇总了Java中org.newdawn.slick.Input.KEY_3属性的典型用法代码示例。如果您正苦于以下问题:Java Input.KEY_3属性的具体用法?Java Input.KEY_3怎么用?Java Input.KEY_3使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.newdawn.slick.Input的用法示例。


在下文中一共展示了Input.KEY_3属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyReleased

/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
	
	if (key == Input.KEY_2) {
		GameState target = game.getState(TestState2.ID);
		
		final long start = System.currentTimeMillis();
		CrossStateTransition t = new CrossStateTransition(target) {				
			public boolean isComplete() {
				return (System.currentTimeMillis() - start) > 2000;
			}

			public void init(GameState firstState, GameState secondState) {
			}
		};
		
		game.enterState(TestState2.ID, t, new EmptyTransition());
	}
	if (key == Input.KEY_3) {
		game.enterState(TestState3.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:TestState1.java

示例2: keyReleased

/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
	if (key == Input.KEY_1) {
		game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
	}
	if (key == Input.KEY_3) {
		game.enterState(TestState3.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:TestState2.java

示例3: keyPressed

/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
	if (key == Input.KEY_1) {
		world = false;
		clip = false;
	}
	if (key == Input.KEY_2) {
		world = false;
		clip = true;
	}
	if (key == Input.KEY_3) {
		world = true;
		clip = false;
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:17,代码来源:ClipTest.java

示例4: setControlKeys

private void setControlKeys() {
    if(this instanceof PacMan) {
        comands[0] = Input.KEY_UP;
        comands[1] = Input.KEY_DOWN;
        comands[2] = Input.KEY_LEFT;
        comands[3] = Input.KEY_RIGHT;
    }
    
    if(this instanceof Blinky) {
        comands[0] = Input.KEY_W;
        comands[1] = Input.KEY_S;
        comands[2] = Input.KEY_A;
        comands[3] = Input.KEY_D;
    }
    
    if(this instanceof Clyde) {
        comands[0] = Input.KEY_T;
        comands[1] = Input.KEY_G;
        comands[2] = Input.KEY_F;
        comands[3] = Input.KEY_H;
    }
    
    if(this instanceof Inky) {
        comands[0] = Input.KEY_I;
        comands[1] = Input.KEY_K;
        comands[2] = Input.KEY_J;
        comands[3] = Input.KEY_L;
    }
    
    if(this instanceof Pinky) {
        comands[0] = Input.KEY_5;
        comands[1] = Input.KEY_2;
        comands[2] = Input.KEY_1;
        comands[3] = Input.KEY_3;
    }
        
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:37,代码来源:Character.java

示例5: update

@Override
public void update(GameState gs, long cTime, int delta) {
	// Make sure player's health is up to date.
	double currentMax = getDoubleAttribute("maxHealth");
	double healthBonus = getIntAttribute("healthUp") * HEALTH_PER_SP;
	if(currentMax != (DEFAULT_MAX_HEALTH + healthBonus)) {
		// Update player's max health.
		setAttribute("maxHealth", (DEFAULT_MAX_HEALTH + healthBonus));
	}
	
	// Need to make sure to update the status effects first.
	Iterator<StatusEffect> it = statusEffects.iterator();
	while(it.hasNext()) {
		StatusEffect status = (StatusEffect) it.next();
		if(status.isActive(cTime)) {
			status.update(this, cTime);
		} else {
			status.onDestroy(this, cTime);
			it.remove();
		}
	}
	
	float adjSpeed = (getSpeed() + (getIntAttribute("speedUp") * (DEFAULT_SPEED * 0.10f))) * (float)getDoubleAttribute("spdMult") * delta;
	if(Globals.inputs.contains(Input.KEY_W)) move(0.0f, -adjSpeed);
	if(Globals.inputs.contains(Input.KEY_A)) move(-adjSpeed, 0.0f);
	if(Globals.inputs.contains(Input.KEY_S)) move(0.0f, adjSpeed);
	if(Globals.inputs.contains(Input.KEY_D)) move(adjSpeed, 0.0f);
	if(Globals.inputs.contains(Input.KEY_R) && 
	   !getCurrentWeapon().isReloading(cTime) &&
	   (getCurrentWeapon().getClipAmmo() != getCurrentWeapon().getClipSize())) {
		getCurrentWeapon().reload(cTime);
	}
	bounds.setLocation((position.x - (getImage().getWidth() / 2)), (position.y - (getImage().getHeight() / 2)));
	
	// Check to see if the player is trying to change weapon by number.
	int [] codes = new int[] { Input.KEY_0, Input.KEY_1, Input.KEY_2, Input.KEY_3, Input.KEY_4,
							   Input.KEY_5, Input.KEY_6, Input.KEY_7, Input.KEY_8, Input.KEY_9 };
	for(int i = 0; i < 10; i++) {
		if(Globals.inputs.contains(codes[i])) {
			if(i == 0) setCurrentWeapon(9);
			else setCurrentWeapon(i - 1);
			break; // To avoid conflicts when holding multiple numerical keys.
		}
	}
	
	Weapon cWeapon = getCurrentWeapon();
	if((Globals.mouse.isMouseDown() || cWeapon.isChargedWeapon()) && cWeapon.canFire(cTime)) {
		cWeapon.fire(this, new Pair<Float>(position.x, position.y), 
					 theta, cTime);
	}
	
	// Update all the player's active weapons.
	getActiveWeapons().stream().forEach(w -> w.update(gs, cTime, delta));
	
	// Calculate the player's rotation based on mouse position.
	theta = Calculate.Hypotenuse(position, Globals.mouse.getPosition()) + (float)(Math.PI / 2);
	flashlight.update(this, cTime);
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:58,代码来源:Player.java


注:本文中的org.newdawn.slick.Input.KEY_3属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。