本文整理汇总了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));
}
}
示例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));
}
}
示例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;
}
}
示例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;
}
}
示例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);
}