Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file added ConsoleApplication50/ConsoleApplication50.sdf
Binary file not shown.
28 changes: 28 additions & 0 deletions ConsoleApplication50/ConsoleApplication50.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication50", "ConsoleApplication50\ConsoleApplication50.vcxproj", "{AF55ACA9-9905-4C1D-811A-12019E79DDAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Debug|x64.ActiveCfg = Debug|x64
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Debug|x64.Build.0 = Debug|x64
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Debug|x86.ActiveCfg = Debug|Win32
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Debug|x86.Build.0 = Debug|Win32
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Release|x64.ActiveCfg = Release|x64
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Release|x64.Build.0 = Release|x64
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Release|x86.ActiveCfg = Release|Win32
{AF55ACA9-9905-4C1D-811A-12019E79DDAC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added ConsoleApplication50/ConsoleApplication50/1.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ConsoleApplication50/ConsoleApplication50/2.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ConsoleApplication50/ConsoleApplication50/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions ConsoleApplication50/ConsoleApplication50/Boss.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
#include "stdafx.h"
#include "Boss.h"
#include"Texture.h"
#include"Gun.h"
#include"Plane.h"
Boss::Boss()
{
A.load(13);//��û�е���boss����
this->state = 0;
this->boosliferemain = 200;//boss״̬1,���޸�[]
this->setTexture(A.BOSS);
this->setPosition(520,0);//���޸�[]
this->gun.setOwner(this, 5);//�ӵ����ʹ��޸�[]
this->launchtoolpoint.setOwner(this);
}

void Boss::heartBeat()
{//��Ҫ����
switch (this->state)
{
case 0:
{//��Ҫֱ��fire
if (this->whetherConversationEnd)
{
static int movestage = -1;
static int count = 0;
if (count > 50)
{
this->fire();
this->gun.setOwner(this, 6);
this->fire();
this->gun.setOwner(this, 5);
count = 0;
}
switch (movestage)
{
case -1:
if (this->getPosition().y <= 50)
this->move(0, 1);
else
movestage++;
break;

case 0:
{
if (this->getPosition().x > 300)
this->move(-4.4, 4);
else
movestage++;
break;
}
case 1:
{
if (this->getPosition().x < 520)
this->move(4.4, -4);
else
movestage++;
break;
}
case 2:
{
if (this->getPosition().x < 740)
this->move(4.4, 4);
else
movestage++;
break;
}
case 3:
{
if (this->getPosition().x > 520)
this->move(-4.4, -4);
else
movestage = 0;
break;
}
}
count++;
}
else
if (clock1.getElapsedTime() >= t5)
this->whetherConversationEnd = 1;//�Ի�ռ��10s
break;
}
case 1:
{ static int count = 0;
if (whetherConversationEnd)
{
whetherConversationEnd = 0;
}
this->setPosition(520, 50); //û����仰�ͷɳ�ȥ��
//����setoweer�������ӵ����͡���

float a = rand() % 200;
float b = rand() % 200;
if (count >= 5)
{
this->move(a, b);
this->fire();
count = 0;
}
count++;
break;
}
case 2:
{
//std::cout << "a";
if (!whetherConversationEnd)
{//���³�ʼ��
clock1.restart();
whetherConversationEnd = 1;
this->gun.setOwner(this, 7);
std::cout << "c";
}
if (this->whetherCOnversationEnd2)
{
this->move(15, 0);
if (this->getPosition().x > 1024)
this->setPosition(0, 250);
if (clock2.getElapsedTime() >= t1)
{
this->fire();
clock2.restart();
}
}
else
if (clock2.getElapsedTime() >= t5)
{
whetherCOnversationEnd2 = 1;
clock2.restart();
}
break;
}//��������������
case 3:
{
std::cout << "d";
if (whetherCOnversationEnd2)//֮ǰend2��ֵΪ1,����������ʼ��,end1��ֵҲΪ1
{
clock1.restart();
whetherCOnversationEnd2 = 0;
this->gun.setOwner(this, 8);
std::cout << "e";
}
if (!whetherConversationEnd)
{
static int count = 0;
if (count >= 100)
{
this->fire();
count = 0;

}
count++;
}
else
if(clock1.getElapsedTime()>=t5)
{
whetherConversationEnd = 0;
clock2.restart();//��һ������
}
break;
}
}
}

bool Boss::needclear()
{
return this->state==4;
}

void Boss::hit()//һ�㲻���ٺ���������������������Ϊ�ٴ��˴�����
{
this->boosliferemain--;
if ((this->boosliferemain) <= 0)
//this->setTexture(A.ENEMY1);//������Ч1
//Sound::ENEMY_DOWN.play();
{
this->state++;
switch (this->state)
{
case 1:
this->boosliferemain = 150;
break;
case 2:
this->boosliferemain = 200;
break;
case 3:
this->boosliferemain = 200;
break;
case 4:
break;
}
}
}


47 changes: 47 additions & 0 deletions ConsoleApplication50/ConsoleApplication50/Boss.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
#include "Boss.h"
#include"Texture.h"
#include"Gun.h"
#include"Plane.h"
class Boss:public Plane
{
public:
Boss();
int boosliferemain;//bossʣ������
int whetherConversationEnd = 0;
int whetherCOnversationEnd2 = 0;
int state= 0;
void heartBeat();
bool needclear();
void hit();
sf::Time t5 = sf::seconds(5);
sf::Time t1 = sf::seconds(1);
sf::Time t10 = sf::seconds(10);
sf::Time t20 = sf::seconds(20);
sf::Clock clock1;
sf::Clock clock2;//����1s����һ���ӵ�
/*
��׼bossģ��
����ֵ
����
��ʼλ��
�ӵ�����
��������
����?
*/
private:
Texture A;
};
/*
int state = 0;
Enemy(int enemytype);
void heartBeat();
void hit();
bool needClear();
bool isDead();//��Ҳ��֪��Ҫ��Ҫ
~Enemy() {};
int enemyliferemain;
private:
int enemytype;
Texture A;*/

Loading