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

📄 netmode.cpp

📁 自制的双子球游戏
💻 CPP
字号:
// NetMode.cpp: implementation of the CNetMode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DBallGame.h"
#include "NetMode.h"
#include "MyDef.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CNetMode::CNetMode()
{

}

CNetMode::~CNetMode()
{

}

bool CNetMode::MoveEx()
{
	bool i;
	if(Pos.y >=y_Above+6&&Pos.y<=y_Above+6+delta_x )//小球步长为2
	{
		i=y_dir;
		if(Analyse(BAR_ABOVE))y_dir=0;
		
		if(i!=y_dir)
		{
			PlaySound("sound",AfxGetResourceHandle(),SND_RESOURCE|SND_ASYNC|SND_NODEFAULT  );
			m_news->SetWindowText ("年轻人,准备好了吗?\n请不要按的太急,谢谢支持");
		}
		return 0;
	}
	if(Pos.y <=y_Below-6&&Pos.y>=y_Below-6-delta_x )
	{
		i=y_dir;
		if(Analyse(BAR_BELOW))y_dir=1;
		if(i!=y_dir)
		{
			PlaySound("sound",AfxGetResourceHandle(),SND_RESOURCE|SND_ASYNC|SND_NODEFAULT  );
			m_news->SetWindowText ("年轻人,准备好了吗?\n请不要按的太急,谢谢支持");
		}
		return 0;
	}
		
	if(Pos.y >=y_Below*11/10-5)
	{
		m_news->SetWindowText ("守擂成功");
		return 1;
	}
	if(Pos.y <=5)
	{
		m_news->SetWindowText ("守擂失败");
		return 1;
	}
	return 0;

}

void CNetMode::Failure()
{
	if(Pos.y <=20)
		AfxMessageBox("守擂成功");
	else
		AfxMessageBox("守擂失败");


}

void CNetMode::InitOther()
{
	
	if(SorC==1)
	{
		x_dir = y_dir = 1;
		Pos.y = WinRect->bottom *10/11-7;
	}
	else 
	{
		x_dir = y_dir = 0;
		Pos.y = WinRect->bottom /11+7;
	}
}

void CNetMode::SetSorC(bool n)
{
	SorC = n;

}

void CNetMode::ResetEx()
{
	
	if(SorC==1)
	{
		x_dir = y_dir = 1;
		PrePos.x = Pos.x = m_BelowBarPos;
		PrePos.y = Pos.y =WinRect->bottom *10/11-7;
	}
	else
	{
		x_dir = y_dir = 0;
		PrePos.x = Pos.x = m_AboveBarPos;
		PrePos.y = Pos.y =WinRect->bottom /11+7;
	}
}

⌨️ 快捷键说明

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