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


Java Keys.DOWN属性代码示例

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


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

示例1: keyDown

@Override
public boolean keyDown(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = true;
	} else if (keycode == Keys.LEFT) {
		leftPressed = true;
	} else if (keycode == Keys.DOWN) {
		downPressed = true;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = true;
	}
	
	if (keycode == Keys.E) {
		ePressed = true;
	} else if (keycode == Keys.W) {
		wPressed = true;
	}

	return false;
}
 
开发者ID:libgdx-examples,项目名称:base-template,代码行数:21,代码来源:InputHandler.java

示例2: keyUp

@Override
public boolean keyUp(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = false;
	} else if (keycode == Keys.LEFT) {
		leftPressed = false;
	} else if (keycode == Keys.DOWN) {
		downPressed = false;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = false;
	}
	
	// When releasing the action key, reset the key delay so they can be pressed again immediately
	if (keycode == Keys.E) {
		ePressed = false;
		actionDelay = 0;
	}
	
	return false;
}
 
开发者ID:libgdx-examples,项目名称:base-template,代码行数:21,代码来源:InputHandler.java

示例3: keyDown

@Override
public boolean keyDown(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = true;
	} else if (keycode == Keys.LEFT) {
		leftPressed = true;
	} else if (keycode == Keys.DOWN) {
		downPressed = true;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = true;
	}
	
	if (keycode == Keys.E) {
		firePressed = true;
	} else if (keycode == Keys.W) {
		shieldPressed = true;
	}
	
	if (keycode == Keys.ENTER) {
		startJustPressed = true;
	}

	return false;
}
 
开发者ID:libgdx-examples,项目名称:space-arcade,代码行数:25,代码来源:InputHandler.java

示例4: keyUp

@Override
public boolean keyUp(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = false;
	} else if (keycode == Keys.LEFT) {
		leftPressed = false;
	} else if (keycode == Keys.DOWN) {
		downPressed = false;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = false;
	}
	
	// When releasing the action key, reset the key delay so they can be pressed again immediately
	if (keycode == Keys.E) {
		firePressed = false;
		actionDelay = 0;
	}
	
	return false;
}
 
开发者ID:libgdx-examples,项目名称:space-arcade,代码行数:21,代码来源:InputHandler.java

示例5: keyDown

@Override
public boolean keyDown (int keycode) {
	switch (keycode) {
	case Keys.DOWN:
		downPressed = true;
		break;
	case Keys.UP:
		upPressed = true;
		break;
	case Keys.LEFT:
		leftPressed = true;
		break;
	case Keys.RIGHT:
		rightPressed = true;
		break;
	}
	return super.keyDown(keycode);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:18,代码来源:VehicleTest.java

示例6: keyUp

@Override
public boolean keyUp (int keycode) {
	switch (keycode) {
	case Keys.DOWN:
		downPressed = false;
		break;
	case Keys.UP:
		upPressed = false;
		break;
	case Keys.LEFT:
		leftPressed = false;
		break;
	case Keys.RIGHT:
		rightPressed = false;
		break;
	case Keys.R:
		chassis.body.setWorldTransform(chassis.transform.setToTranslation(0, 5, 0));
		chassis.body.setInterpolationWorldTransform(chassis.transform);
		((btRigidBody)(chassis.body)).setLinearVelocity(Vector3.Zero);
		((btRigidBody)(chassis.body)).setAngularVelocity(Vector3.Zero);
		chassis.body.activate();
		break;
	}
	return super.keyUp(keycode);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:25,代码来源:VehicleTest.java

示例7: keyDown

@Override
public boolean keyDown(int keycode) {
	if (keycode == Keys.LEFT)
		controller.leftPressed();
	if (keycode == Keys.RIGHT)
		controller.rightPressed();
	if (keycode == Keys.DOWN)
	{
		controller.downPressed();
	}
	if(keycode == Keys.BACK) {
		if (isMultiPlayer) {
			NextpeerPlugin.reportForfeitForCurrentTournament();
		}

		dispose();
		System.out.println("c");
		game.setScreen(new MainScreen(game));
	}

	return true;
}
 
开发者ID:Nextpeer,项目名称:SkiFun,代码行数:22,代码来源:GameScreen.java

示例8: keyDown

@Override
public boolean keyDown(final int keycode) {
	switch (keycode) {
	case Keys.UP:
		TurnScheduler.getInstance().addTurnToQueue(Move.UP);
		return true;
	case Keys.DOWN:
		TurnScheduler.getInstance().addTurnToQueue(Move.DOWN);
		return true;
	case Keys.LEFT:
		TurnScheduler.getInstance().addTurnToQueue(Move.LEFT);
		return true;
	case Keys.RIGHT:
		TurnScheduler.getInstance().addTurnToQueue(Move.RIGHT);
		return true;
	default:
		return false;
	}
}
 
开发者ID:davidbecker,项目名称:taloonerrl,代码行数:19,代码来源:InputSystem.java

示例9: KeyboardControl

public KeyboardControl() {
    // Initial settings:
    up = Keys.UP;
    down = Keys.DOWN;
    left = Keys.LEFT;
    right = Keys.RIGHT;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:7,代码来源:KeyboardControl.java

示例10: onTurn

@Override
/*********************************************************
 * Called on every turn
 * @return true if something actually happened in a turn
 * (if false, the player is NOT moved in the queue!)
 *********************************************************/
public boolean onTurn(){
	super.onTurn();
	Core.redraw = true; 
	Integer log = input.checkKeys();
	if (log == null) return false; 
	switch (log){
	case Keys.LEFT: 
		move(-1, 0);
		break; 
	case Keys.RIGHT:
		move(1, 0);
		break; 
	case Keys.UP:
		move(0, 1);
		break; 
	case Keys.DOWN:
		move(0, -1); 
		break; 
	case Keys.E:
		Core.game.setScreen(new DungeonOverviewScreen(holder.getDungeon().getWorld()));
	case Keys.X:
		holder.useStairs();
		holder.getDungeon().getWorld().changeFloors(holder.getDungeon());
		break; 
	default:
		return false; 
	}
	housekeep(); 
	return true; 
}
 
开发者ID:lries,项目名称:Oozelike,代码行数:36,代码来源:PlayerAI.java

示例11: checkKeys

/********************************************
 * Check keys for presses
 * Automatically converts synonymous keys
 * @return the highest priority active key
 ********************************************/
public Integer checkKeys(){
	if (checkKey(Keys.UP) || checkKey(Keys.W)) return Keys.UP;
	if (checkKey(Keys.DOWN) || checkKey(Keys.S)) return Keys.DOWN;
	if (checkKey(Keys.LEFT) || checkKey(Keys.A)) return Keys.LEFT;
	if (checkKey(Keys.RIGHT) || checkKey(Keys.D)) return Keys.RIGHT;
	if (checkNewKey(Keys.X)) return Keys.X;
	if (checkNewKey(Keys.E)) return Keys.E; 
	return null; 
}
 
开发者ID:lries,项目名称:Oozelike,代码行数:14,代码来源:KeyLogger.java

示例12: keyDown

@Override
public boolean keyDown(int keycode) {
	if (InputUtil.isArrowKey(keycode)) {
		keyScrollingX = Keys.LEFT == keycode ? -1 : (Keys.RIGHT == keycode ? 1 : keyScrollingX);
		keyScrollingY = Keys.DOWN == keycode ? -1 : (Keys.UP == keycode ? 1 : keyScrollingY);
	}

	return false;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:9,代码来源:CameraController.java

示例13: keyUp

@Override
public boolean keyUp(int keycode) {
	if (InputUtil.isArrowKey(keycode)) {
		if (Keys.LEFT == keycode || Keys.RIGHT == keycode) {
			keyScrollingX = 0;
		} else if (Keys.DOWN == keycode || Keys.UP == keycode) {
			keyScrollingY= 0;
		}
	}
	return false;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:CameraController.java

示例14: keyUp

@Override
public boolean keyUp(int keycode) {
	if(_MoveListeners.size() > 0)
	{
		switch (keycode)
		{
		case Keys.DOWN:
			for(MoveListener listener : _MoveListeners)
				listener.Uncrouch();
			return true;
		}
	}
	return false;
}
 
开发者ID:mitsuhirato,项目名称:TheEndlessCastle,代码行数:14,代码来源:PlayerComponent.java

示例15: collide

@Override
public void collide(Mario mario, AbstractSprite item, GameCamera camera, Array<IScrollingBackground> scrollingBackgrounds) {
	
	TransferItem transferItem = (TransferItem)item;
	
	if (Gdx.input.isKeyPressed(transferItem.getKeyToPress())) {	
		// Mario collides with the transport element, check if the user if pressing the correct key to teleport Mario
		
		// Store the item in Mario class to play the animation before moving physically Mario to his new position
		mario.setTransferItem(transferItem);
		mario.setInTransfer(true);			
		
		// Define an action to move Mario during the animation of the teleportation
		Action moveAction = null;
		
		if (transferItem.getKeyToPress()==Keys.DOWN) {
			// Mario is entering a pipe to the bottom
			mario.setX(((int)transferItem.getX()) + 0.5f);
			moveAction = ActionFacade.createMoveAction(mario.getX(), mario.getY()-2, 1.5f);
			mario.setCurrentAnimation(mario.getMarioVictoryAnimation());
		} else if (transferItem.getKeyToPress()==Keys.RIGHT) {
			// Mario is entering a pipe on his right
			mario.setY(((int)transferItem.getY()));
			moveAction = ActionFacade.createMoveAction(((int)transferItem.getX())+1, mario.getY(), 1.5f);
			mario.setCurrentAnimation(mario.getMarioRunRightAnimation());
		}
		mario.addAction(moveAction);			
		SoundManager.getSoundManager().playSound(SoundManager.SOUND_PIPE);			
		}
}
 
开发者ID:provenza24,项目名称:Mario-Libgdx,代码行数:30,代码来源:TransferCollisionHandler.java


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