本文整理匯總了Java中org.newdawn.slick.Input.KEY_DOWN屬性的典型用法代碼示例。如果您正苦於以下問題:Java Input.KEY_DOWN屬性的具體用法?Java Input.KEY_DOWN怎麽用?Java Input.KEY_DOWN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.newdawn.slick.Input
的用法示例。
在下文中一共展示了Input.KEY_DOWN屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: keyPressed
/**
* @see org.newdawn.slick.BasicGame#keyPressed(int, char)
*/
public void keyPressed(int key, char c) {
if (key == Input.KEY_ESCAPE) {
System.exit(0);
}
if (key == Input.KEY_Q) {
scaleUp = true;
}
if (key == Input.KEY_A) {
scaleDown = true;
}
if( key == Input.KEY_LEFT) {
moveLeft = true;
}
if( key == Input.KEY_UP ) {
moveUp = true;
}
if( key == Input.KEY_RIGHT ) {
moveRight = true;
}
if( key == Input.KEY_DOWN ) {
moveDown = true;
}
}
示例2: keyReleased
/**
* @see org.newdawn.slick.BasicGame#keyReleased(int, char)
*/
public void keyReleased(int key, char c) {
if (key == Input.KEY_Q) {
scaleUp = false;
}
if (key == Input.KEY_A) {
scaleDown = false;
}
if( key == Input.KEY_LEFT) {
moveLeft = false;
}
if( key == Input.KEY_UP ) {
moveUp = false;
}
if( key == Input.KEY_RIGHT ) {
moveRight = false;
}
if( key == Input.KEY_DOWN ) {
moveDown = false;
}
}
示例3: keyReleased
/**
* @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
*/
public void keyReleased(int key, char c) {
if (key == Input.KEY_DOWN) {
selected++;
if (selected >= options.length) {
selected = 0;
}
}
if (key == Input.KEY_UP) {
selected--;
if (selected < 0) {
selected = options.length - 1;
}
}
if (key == Input.KEY_1) {
game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
if (key == Input.KEY_2) {
game.enterState(TestState2.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
}
示例4: keyPressed
@Override
public void keyPressed(int key, char c) {
switch (key) {
case Input.KEY_UP:
this.direction = 0;
this.moving = true;
break;
case Input.KEY_LEFT:
this.direction = 1;
this.moving = true;
break;
case Input.KEY_DOWN:
this.direction = 2;
this.moving = true;
break;
case Input.KEY_RIGHT:
this.direction = 3;
this.moving = true;
break;
}
}
示例5: 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;
}
}