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

📄 gamer.cpp

📁 C人工智能游戏开发的一些实例源代码 C Game development in artificial intelligence source code of some examples
💻 CPP
字号:
//----------------------------------------------------------------------------------------------
// Sequential Prediction Demo: The positioning pattern
// 
// Author:  Fri Mommersteeg
// Date:    10-09-2001
// File:    Gamer.cpp
//----------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------
// Include files
//----------------------------------------------------------------------------------------------

#include "stdafx.h"
#include "gamer.h"

//----------------------------------------------------------------------------------------------
// HandleUserInput(): forwards commands from the keyboard to the paddle
//----------------------------------------------------------------------------------------------

void CGamer::HandleUserInput() {

	if KEY_DOWN(VK_LEFT) {
		Left();
	}
	if KEY_DOWN(VK_RIGHT) {
		Right();
	}
	if KEY_DOWN(VK_UP) {
		if (direction==-1) Up(); else Down();
	}
	if KEY_DOWN(VK_DOWN) {
		if (direction==-1) Down(); else Up();
	}
	if KEY_DOWN(VK_Z) {
		Rotate(-(int)NormSpeed(ROTATE_SPEED));
	}
	if KEY_DOWN(VK_X) {
		Rotate((int)NormSpeed(ROTATE_SPEED));
	}
}

//----------------------------------------------------------------------------------------------
// Update(): override of CPaddle::Update() to handle user input
//----------------------------------------------------------------------------------------------

void CGamer::Update() {
	HandleUserInput();
	CPaddle::Update();
}

⌨️ 快捷键说明

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