diff --git a/ConsoleApplication50/.vs/ConsoleApplication50/v14/.suo b/ConsoleApplication50/.vs/ConsoleApplication50/v14/.suo new file mode 100644 index 00000000..5481cbce Binary files /dev/null and b/ConsoleApplication50/.vs/ConsoleApplication50/v14/.suo differ diff --git a/ConsoleApplication50/ConsoleApplication50.sdf b/ConsoleApplication50/ConsoleApplication50.sdf new file mode 100644 index 00000000..fae12f50 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50.sdf differ diff --git a/ConsoleApplication50/ConsoleApplication50.sln b/ConsoleApplication50/ConsoleApplication50.sln new file mode 100644 index 00000000..a0b42459 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50.sln @@ -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 diff --git a/ConsoleApplication50/ConsoleApplication50/1.JPG b/ConsoleApplication50/ConsoleApplication50/1.JPG new file mode 100644 index 00000000..12b94bf6 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/1.JPG differ diff --git a/ConsoleApplication50/ConsoleApplication50/123.jpg b/ConsoleApplication50/ConsoleApplication50/123.jpg new file mode 100644 index 00000000..e67ef596 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/123.jpg differ diff --git a/ConsoleApplication50/ConsoleApplication50/2.JPG b/ConsoleApplication50/ConsoleApplication50/2.JPG new file mode 100644 index 00000000..b44a54e0 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/2.JPG differ diff --git a/ConsoleApplication50/ConsoleApplication50/4.png b/ConsoleApplication50/ConsoleApplication50/4.png new file mode 100644 index 00000000..d5af26ee Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/4.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/Boss.cpp b/ConsoleApplication50/ConsoleApplication50/Boss.cpp new file mode 100644 index 00000000..ea777386 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Boss.cpp @@ -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; + } + } +} + + diff --git a/ConsoleApplication50/ConsoleApplication50/Boss.h b/ConsoleApplication50/ConsoleApplication50/Boss.h new file mode 100644 index 00000000..2aa1defd --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Boss.h @@ -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;*/ + diff --git a/ConsoleApplication50/ConsoleApplication50/Bullet.cpp b/ConsoleApplication50/ConsoleApplication50/Bullet.cpp new file mode 100644 index 00000000..8f667d52 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Bullet.cpp @@ -0,0 +1,340 @@ +#include "stdafx.h" +#include "Bullet.h" +#include "Texture.h"//ҪʵҪõtexture + +Bullet::Bullet(float x, float y, int kind) +{ + this->setPosition(x, y); + this->kind = kind; + A.load(7); + switch (kind) + { + case 1://Ի + { + A.load(7); + this->setTexture(A.BULLET);//bulletô + break; + } + case 2: {//ͨӵ + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 3: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 4: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 5: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 6: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 7: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 8: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 9: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 10: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 11: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 12: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 13: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 14: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 15: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 16: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 17: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 18: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 19: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 20: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 21: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 22: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 23: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 24: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 25: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 26: { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 27://light + { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 28://light + { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + case 29://light + { + A.load(12); + this->setTexture(A.ENEMYBULLET); + break; + } + } +} +void Bullet::heartBeat() { + switch (kind) + { + case 1://ԼӵΪ1IJͬøӵ + { + this->move(0, -50); + break; + } + case 2: + { + this->move(0, 10);// + //this->move((savex - x) / 10, (savey - y) / 10); + break; + } + case 3://б + { + this->move(5, 5); + break; + } + case 4://б + { + this->move(-5, 5); + break; + } + case 5://Ƶ + { + this->move(2, 5); + break; + } + case 6://Ƶ + { + this->move(-2, 5); + break; + } + case 7://б(޷ʵ) + { + if (!whetherIsetdirection) { + savex = rand() % 100; + savey = rand() % 100; + this->whetherIsetdirection = 1; + } + this->move(savex, savey); + } + case 8: {//0 + this->move(10, 0); + break; + } + case 9: {//30 + this->move(8.7, -5.1); + break; + } + case 10: {//60 + this->move(5.1, -8.7); + break; + } + case 11: { + this->move(0, -10); + break; + } + case 12: {//120 + this->move(-5.1, -8.7); + break; + } + case 13: {//150 + this->move(-8.7, -5.1); + break; + } + case 14: {//180 + this->move(-10, 0); + break; + } + case 15: { + this->move(-8.7, 5.1); + break; + } + case 16: { + this->move(-5.1, 8.7); + break; + } + case 17: { + this->move(0, 10); + break; + } + case 18: { + this->move(5.1, 8.7); + break; + } + case 19: { + this->move(8.7, 5.1); + break; + } + case 20://ڶ + { + this->move(2.000, 8.000); + break; + } + case 21: + { + this->move(0.000, 8.000); + break; + } + case 22: + { + this->move(-2.000, 8.000); + break; + } + case 23: + { + this->move(1.600, 6.000); + break; + } + case 24: + { + this->move(-1.600, 6.000); + break; + } + case 25: + { + this->move(0.000, 4.000); + break; + } + case 26: + { + this->move(-1.000, 4.000); + break; + } + case 27: + { + float a = rand() % 4;//ڿƹ켣 + this->move(a, 8); + break; + } + case 28: + { + float a = -rand() % 4;//ڿƹ켣 + this->move(a, 8); + break; + } + case 29: + { + static int a; + static int b; + static int condition = 0; + switch (condition) + { + case 0: + a = -(rand() % 10); + b = rand() % 10; + this->move(a, b); + condition++; + break; + case 1: + if (this->getPosition().x < 11) + { + a = -a; + this->move(a, b); + condition++; + break; + } + else + this->move(a, b); + break; + case 2: + if (this->getPosition().y > 763) + { + b = -b; + this->move(a, b); + break; + } + else + this->move(a, b); + break; + } + } + } +} + + diff --git a/ConsoleApplication50/ConsoleApplication50/Bullet.h b/ConsoleApplication50/ConsoleApplication50/Bullet.h new file mode 100644 index 00000000..7992a311 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Bullet.h @@ -0,0 +1,20 @@ +#pragma once +#include "Sprite.h" +#include"Texture.h" +#include"GetHeroPosition.h" +#include"Hero.h"//1111111111111111111111111111111111111111 +class Bullet:public Sprite//ҪõgetpositionҪ̳иsprite +{ +public: + Bullet(float x, float ,int kind);//Bulletkindchxҵ + void heartBeat();//⺯ʲôõ(ӵ켣 +private: + Texture A; + int kind; + float x; + float y; + float savex;//Իѵĸý + float savey; + int whetherIsetdirection=0; +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.aps b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.aps new file mode 100644 index 00000000..a08e23cd Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.aps differ diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.cpp b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.cpp new file mode 100644 index 00000000..2c3f60ff --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.cpp @@ -0,0 +1,112 @@ +#include"stdafx.h" +#define Ten 10 +#include +#include +#include +#include +#include +//#include +//#include"Sound.h" +#include"Texture.h" +#include"Hero.h" +#include"Sky.h"//ӵ +#include + +int main() { + //Sound::load(); + /*sf::Texture DongPoint; + sf::Texture PowerPoint; + DongPoint.loadFromFile("DongPoint.JPG"); + PowerPoint.loadFromFile("Ppoint.JPG"); + sf::Sprite DongPoint1(DongPoint); + sf::Sprite PowerPoint1(PowerPoint); + DongPoint1.setPosition(sf::Vector2f(1052, 64)); + PowerPoint1.setPosition(sf::Vector2f(1052, 164)); + */ + Sky* sky = Sky::getInstance(); + sf::RenderWindow* window = sky->getWindow(); + //Sound::BACK_GROUND.play(); + Hero hero; + sky->add(&hero); + int a = 0; + int usebomb = 0;//Ƿʹըҩ + //int stage = 0;//0=С֣1=bossս + sf::Time t1 = sf::seconds(20);//ʵ[][][] + sf::Clock clock1;//ʵ[][][] + window->setFramerateLimit(100); + while (window->isOpen()) { + sf::Event event; + while (window->pollEvent(event)) { + if (event.type == sf::Event::Closed) + { + window->close(); + } + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Q) + { + window->close(); + } + } + {//ƺûĴ + if (event.type == sf::Event::Closed) + { + window->close(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) + { + window->close(); + }// + + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) + { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) + hero.move2leftslow(); + else + hero.move2left(); + //оס벻ס + } + + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) + { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) + hero.move2rightslow(); + else + hero.move2right(); + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) + { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) + hero.move2upslow(); + else + hero.move2up(); + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) + { + if (sf::Keyboard::isKeyPressed(sf::Keyboard::LShift)) + hero.move2downslow(); + else + hero.move2down(); + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Z)) + { + hero.fire(); + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::X)) + { + if (hero.havebomb()) //bossս + { + sky->bombclear();//Ľ޵ʱ + hero.bomblost(); + hero.clockWD.restart(); + hero.whetherWD = 1; + } + } + sky->whetherIdied(&hero); + sky->refresh(); + sky->whetherIgetDong(&hero);//仰ȽϺã + } + } + return EXIT_SUCCESS; +} + + diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.rc b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.rc new file mode 100644 index 00000000..1d2130dd Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.rc differ diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj new file mode 100644 index 00000000..01fe58d0 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj @@ -0,0 +1,215 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {AF55ACA9-9905-4C1D-811A-12019E79DDAC} + Win32Proj + ConsoleApplication50 + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + WIN32;SFML_STATIC + true + D:\SFML-2.3.2\include + + + Console + true + D:\SFML-2.3.2\lib + sfml-audio.lib;sfml-graphics-s-d.lib;sfml-window-s-d.lib;sfml-system-s-d.lib;sfml-network-s-d.lib;sfml-audio-s-d.lib;sfml-graphics-s.lib;sfml-window-s.lib;sfml-system-s.lib;sfml-network-s.lib;sfml-audio-s.lib;opengl32.lib;winmm.lib;freetype.lib;jpeg.lib;gdi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Use + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;SFML_STATIC + true + D:\SFML-2.3.2\include + + + Console + true + true + true + D:\SFML-2.3.2\lib + sfml-audio.lib;sfml-graphics-s-d.lib;sfml-window-s-d.lib;sfml-system-s-d.lib;sfml-network-s-d.lib;sfml-audio-s-d.lib;sfml-graphics-s.lib;sfml-window-s.lib;sfml-system-s.lib;sfml-network-s.lib;sfml-audio-s.lib;opengl32.lib;winmm.lib;freetype.lib;jpeg.lib;gdi32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.filters b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.filters new file mode 100644 index 00000000..fa12f16c --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.filters @@ -0,0 +1,154 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + 源文件 + + + + + 资源文件 + + + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + 资源文件 + + + + + + + + + \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.user b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.user new file mode 100644 index 00000000..a11cd7f9 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ConsoleApplication50.vcxproj.user @@ -0,0 +1,6 @@ + + + + true + + \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Boss.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Boss.obj new file mode 100644 index 00000000..b51fac92 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Boss.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Bullet.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Bullet.obj new file mode 100644 index 00000000..d1d77ff4 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Bullet.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.command.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.command.1.tlog new file mode 100644 index 00000000..6e22a661 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.command.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.read.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.read.1.tlog new file mode 100644 index 00000000..d5d4f2e7 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.read.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.write.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.write.1.tlog new file mode 100644 index 00000000..115d72fb Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/CL.write.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/ConsoleApplication50.lastbuildstate b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/ConsoleApplication50.lastbuildstate new file mode 100644 index 00000000..2c827fdb --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/ConsoleApplication50.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit +Debug|Win32|C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\| diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.command.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.command.1.tlog new file mode 100644 index 00000000..c3c2ed1f Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.command.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.read.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.read.1.tlog new file mode 100644 index 00000000..112d9e8b Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.read.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.write.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.write.1.tlog new file mode 100644 index 00000000..5aef718a Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/link.write.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.command.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.command.1.tlog new file mode 100644 index 00000000..5f883998 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.command.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.read.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.read.1.tlog new file mode 100644 index 00000000..8065da5b Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.read.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.write.1.tlog b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.write.1.tlog new file mode 100644 index 00000000..10cd9e3d Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleA.AF55ACA9.tlog/rc.write.1.tlog differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.log b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.log new file mode 100644 index 00000000..a74fbc07 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.log @@ -0,0 +1,70 @@ +生成启动时间为 2016/6/2 8:22:33。 + 1>项目“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\ConsoleApplication50\ConsoleApplication50.vcxproj”在节点 2 上(Build 个目标)。 + 1>Link: + C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\ConsoleApplication50.exe" /INCREMENTAL /NOLOGO /LIBPATH:"D:\SFML-2.3.2\lib" "sfml-audio.lib" "sfml-graphics-s-d.lib" "sfml-window-s-d.lib" "sfml-system-s-d.lib" "sfml-network-s-d.lib" "sfml-audio-s-d.lib" "sfml-graphics-s.lib" "sfml-window-s.lib" "sfml-system-s.lib" "sfml-network-s.lib" "sfml-audio-s.lib" opengl32.lib winmm.lib freetype.lib jpeg.lib gdi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /Debug /PDB:"C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\ConsoleApplication50.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\ConsoleApplication50.lib" /MACHINE:X86 Debug\ConsoleApplication50.res + Debug\Boss.obj + Debug\Bullet.obj + Debug\ConsoleApplication50.obj + Debug\Enemy.obj + Debug\Gun.obj + Debug\Hero.obj + Debug\LaunchToolPoint.obj + Debug\Plane.obj + Debug\Sky.obj + Debug\Sprite.obj + Debug\stdafx.obj + Debug\Texture.obj + Debug\ToolPoint.obj + 1>sfml-graphics-s-d.lib(BlendMode.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(BlendMode.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Color.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Color.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(GLCheck.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(GLCheck.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(GLExtensions.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(GLExtensions.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Image.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Image.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(ImageLoader.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(ImageLoader.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(RenderStates.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(RenderStates.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(RenderTarget.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(RenderTarget.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(RenderWindow.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(RenderWindow.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Shader.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Shader.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Texture.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Texture.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(TextureSaver.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(TextureSaver.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Transform.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Transform.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Transformable.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Transformable.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(View.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(View.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Vertex.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Vertex.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(GLLoader.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(GLLoader.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-graphics-s-d.lib(Sprite.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-graphics-s-d.lib(Sprite.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(Context.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(Context.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(GlContext.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(GlContext.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(GlResource.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(GlResource.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(Joystick.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(Joystick.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(JoystickManager.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(JoystickManager.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(Keyboard.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(Keyboard.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(SensorManager.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(SensorManager.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(VideoMode.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(VideoMode.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(Window.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(Window.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(WindowImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(WindowImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(WglContext.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(WglContext.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(WglExtensions.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(WglExtensions.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(InputImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(InputImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(JoystickImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(JoystickImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(SensorImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(SensorImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(VideoModeImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(VideoModeImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-window-s-d.lib(WindowImplWin32.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-window-s-d.lib(WindowImplWin32.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Clock.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Clock.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Err.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Err.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Lock.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Lock.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Mutex.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Mutex.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Sleep.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Sleep.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(String.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(String.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(ThreadLocal.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(ThreadLocal.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(Time.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(Time.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(ClockImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(ClockImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(MutexImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(MutexImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(SleepImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(SleepImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + 1>sfml-system-s-d.lib(ThreadLocalImpl.cpp.obj) : warning LNK4099: 未找到 PDB“vc140.pdb”(使用“sfml-system-s-d.lib(ThreadLocalImpl.cpp.obj)”或在“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\vc140.pdb”中寻找);正在链接对象,如同没有调试信息一样 + ConsoleApplication50.vcxproj -> C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\ConsoleApplication50.exe + 1>已完成生成项目“C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\ConsoleApplication50\ConsoleApplication50.vcxproj”(Build 个目标)的操作。 + +已成功生成。 + +已用时间 00:00:01.23 diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.obj b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.obj new file mode 100644 index 00000000..d9749336 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.pch b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.pch new file mode 100644 index 00000000..dc269a63 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.pch differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.res b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.res new file mode 100644 index 00000000..36f26e23 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ConsoleApplication50.res differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Enemy.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Enemy.obj new file mode 100644 index 00000000..5c61a23d Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Enemy.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/GetHeroPosition.obj b/ConsoleApplication50/ConsoleApplication50/Debug/GetHeroPosition.obj new file mode 100644 index 00000000..dc0b9790 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/GetHeroPosition.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Gun.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Gun.obj new file mode 100644 index 00000000..726c3625 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Gun.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Hero.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Hero.obj new file mode 100644 index 00000000..bb95624e Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Hero.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/LaunchToolPoint.obj b/ConsoleApplication50/ConsoleApplication50/Debug/LaunchToolPoint.obj new file mode 100644 index 00000000..67e18d08 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/LaunchToolPoint.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Plane.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Plane.obj new file mode 100644 index 00000000..6136d011 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Plane.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Sky.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Sky.obj new file mode 100644 index 00000000..1155b016 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Sky.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Sound.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Sound.obj new file mode 100644 index 00000000..a4768923 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Sound.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Sprite.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Sprite.obj new file mode 100644 index 00000000..e035af47 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Sprite.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/Texture.obj b/ConsoleApplication50/ConsoleApplication50/Debug/Texture.obj new file mode 100644 index 00000000..6d2602d5 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/Texture.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/ToolPoint.obj b/ConsoleApplication50/ConsoleApplication50/Debug/ToolPoint.obj new file mode 100644 index 00000000..ab1648a6 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/ToolPoint.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/abc.obj b/ConsoleApplication50/ConsoleApplication50/Debug/abc.obj new file mode 100644 index 00000000..e06eb9b2 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/abc.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/consoleapplication50.obj.enc b/ConsoleApplication50/ConsoleApplication50/Debug/consoleapplication50.obj.enc new file mode 100644 index 00000000..e3237971 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/consoleapplication50.obj.enc differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/enemy.obj.enc b/ConsoleApplication50/ConsoleApplication50/Debug/enemy.obj.enc new file mode 100644 index 00000000..4cc668ee Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/enemy.obj.enc differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/stdafx.obj b/ConsoleApplication50/ConsoleApplication50/Debug/stdafx.obj new file mode 100644 index 00000000..ac300e46 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/stdafx.obj differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/vc140.idb b/ConsoleApplication50/ConsoleApplication50/Debug/vc140.idb new file mode 100644 index 00000000..f134aed4 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/vc140.idb differ diff --git a/ConsoleApplication50/ConsoleApplication50/Debug/vc140.pdb b/ConsoleApplication50/ConsoleApplication50/Debug/vc140.pdb new file mode 100644 index 00000000..de84435f Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Debug/vc140.pdb differ diff --git a/ConsoleApplication50/ConsoleApplication50/DongPoint.JPG b/ConsoleApplication50/ConsoleApplication50/DongPoint.JPG new file mode 100644 index 00000000..9e889340 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/DongPoint.JPG differ diff --git a/ConsoleApplication50/ConsoleApplication50/Enemy.cpp b/ConsoleApplication50/ConsoleApplication50/Enemy.cpp new file mode 100644 index 00000000..7f1a47a9 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Enemy.cpp @@ -0,0 +1,150 @@ +#include "stdafx.h" +#include "Enemy.h" +#include "Texture.h" +//#include "Sound.h" +#include +#include +using namespace std; + +Enemy::Enemy(int enemytype) { + this->enemytype = enemytype; + float a = rand();//ɾ + /* + ׼ģ + ֵ + ò + ʼλ + ӵ + + + */ + switch (enemytype) + { + case 1://ͨĵ + { + float a = rand() % 500; + float b = rand() % 100; + A.load(2); + this->enemyliferemain = 10;//ֵ޸ + this->setTexture(A.ENEMY1); + this->setPosition(a, b);// + this->gun.setOwner(this, 2); + this->launchtoolpoint.setOwner(this); + this->fire(); + break; + } + case 2://3ӵĵ + { + float a = rand() % 100; + A.load(11); + this->enemyliferemain = 10; + this->setTexture(A.ENEMY2); + this->setPosition(a, 100); + this->gun.setOwner(this, 2); + this->launchtoolpoint.setOwner(this); + this->fire(); + break; + } + case 3: {//ʬĵ + float a = rand() % 1024; + A.load(11); + this->enemyliferemain = 1; + this->setTexture(A.ENEMY2); + this->setPosition(a, 50);// + this->gun.setOwner(this, 3); + this->launchtoolpoint.setOwner(this); + break; + } + case 4: {//б͵//Իѣ + break; + } + /*case 5: {//صС֣ + this->enemyliferemain = 500;//ֵ + this->setTexture(A.ENEMY2); + this->setPosition(487, 50); + this->gun.setOwner(this, 4); + this->launchtoolpoint.setOwner(this); + break; + }*/ + + break; + } +} +void Enemy::heartBeat() { + A.load(3); + A.load(4); + A.load(5); + switch (this->state) + {//Ƶ˶ + case 0: + { + switch (enemytype) + { + case 1: + { + this->move(5, 0); + break; + } + case 2: + { + static int count = 0; + this->move(10, 0); + if (count++ > 60) + { + this->fire(); + count =0; + } + break; + } + case 3: + { + this->move(0, 3); + break; + } + case 5: + { + ;//䡾 + } + break; + } + break;//switchҪbreak + } + case 1:// + this->setTexture(A.ENEMY_DOWN_1);//Ч1... + this->state++; + break; + case 2: + this->setTexture(A.ENEMY_DOWN_2); + this->state++; + if(this->enemytype==1) + this->launch(); + if (this->enemytype == 2) + this->launch();//ʬ + if (this->enemytype == 3) + this->gun.fire(); + break; +/* case 3: + this->setTexture(A.ENEMY_DOWN_3); + this->state++; + this->launch(); + break; + default: + break;*/ + } +} + +void Enemy::hit() { + this->enemyliferemain--; + if ((this->enemyliferemain) <= 0) + //this->setTexture(A.ENEMY1);//Ч1 + //Sound::ENEMY_DOWN.play(); + this->state++; +} + +bool Enemy::needClear() { + return (this->getPosition().x<0||this->getPosition().x>1024||this->getPosition().y<0||this->getPosition().y>768||this->state==3); +} + +bool Enemy::isDead() { + return this->state !=0;//isdeadô[][][][][][][][][][][][][][] +} diff --git a/ConsoleApplication50/ConsoleApplication50/Enemy.h b/ConsoleApplication50/ConsoleApplication50/Enemy.h new file mode 100644 index 00000000..2bebd95f --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Enemy.h @@ -0,0 +1,20 @@ +#pragma once +#include"Texture.h" +#include"Gun.h" +#include"Plane.h" +#include"ToolPoint.h" +class Enemy :public Plane { +public: + int state = 0; + Enemy(int enemytype); + void heartBeat(); + void hit(); + bool needClear(); + bool isDead(); + ~Enemy() {}; + int enemyliferemain; +private: + int enemytype; + Texture A; +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Fighters-Info.plist b/ConsoleApplication50/ConsoleApplication50/Fighters-Info.plist new file mode 100644 index 00000000..d22e329a --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Fighters-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + uestc.cpp.edu.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + + diff --git a/ConsoleApplication50/ConsoleApplication50/FindHero.cpp b/ConsoleApplication50/ConsoleApplication50/FindHero.cpp new file mode 100644 index 00000000..5f35c3ae --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/FindHero.cpp @@ -0,0 +1,8 @@ +#include "stdafx.h" +#include "FindHero.h" +sf::Vector2f FindHero::getposition(Hero * hero) +{ + sf::Vector2f ff; + ff=hero->getPosition(); + return ff; +} diff --git a/ConsoleApplication50/ConsoleApplication50/FindHero.h b/ConsoleApplication50/ConsoleApplication50/FindHero.h new file mode 100644 index 00000000..4b6324f8 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/FindHero.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include"Hero.h" +class FindHero +{ +public: + sf::Vector2f ff; + sf::Vector2f getposition(Hero* hero); + +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Game.cpp b/ConsoleApplication50/ConsoleApplication50/Game.cpp new file mode 100644 index 00000000..3d2f17fe --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Game.cpp @@ -0,0 +1,19 @@ +// +// Game.cpp +// Fighters +// +// Created by luckymark on 13-10-28. +// Copyright (c) 2013年 luckymark. All rights reserved. +// + +#include "Game.h" + +Game* Game::instance = nullptr; +std::default_random_engine Game::random_engine(time(0)); + +Game* Game::getInstance(){ + if(!instance){ + instance = new Game; + } + return instance; +} \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/Game.h b/ConsoleApplication50/ConsoleApplication50/Game.h new file mode 100644 index 00000000..0c2931eb --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Game.h @@ -0,0 +1,25 @@ +// +// Game.h +// Fighters +// +// Created by luckymark on 13-10-28. +// Copyright (c) 2013年 luckymark. All rights reserved. +// + +#ifndef __Fighters__Game__ +#define __Fighters__Game__ + +#include +#include + +class Game{ +public: + static Game* getInstance(); + static std::default_random_engine random_engine; +private: +// Game(); + + static Game* instance; +}; + +#endif /* defined(__Fighters__Game__) */ diff --git a/ConsoleApplication50/ConsoleApplication50/Gameover.png b/ConsoleApplication50/ConsoleApplication50/Gameover.png new file mode 100644 index 00000000..bef40fd0 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Gameover.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.cpp b/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.cpp new file mode 100644 index 00000000..c33631ee --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.cpp @@ -0,0 +1,12 @@ +#include "stdafx.h" +#include "GetHeroPosition.h" + +void getposition(Hero * hero) +{ + GetHeroPosition::ff =hero->getPosition(); +} +/* +sf::Vector2f Gun::getPosition() { + sf::Vector2f ff; + return ff;//κβ +}*/ diff --git a/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.h b/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.h new file mode 100644 index 00000000..ab93c8d2 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/GetHeroPosition.h @@ -0,0 +1,10 @@ +#pragma once +#include"Hero.h" +#include +class GetHeroPosition +{ +public: + friend void getposition(Hero *hero); + static sf::Vector2f ff; +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Gun.cpp b/ConsoleApplication50/ConsoleApplication50/Gun.cpp new file mode 100644 index 00000000..7bc05041 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Gun.cpp @@ -0,0 +1,163 @@ +#include "stdafx.h" +#include "Gun.h" +#include"Plane.h" +#include"Bullet.h" +#include"Sky.h" +void Gun::fire() { + sf::Vector2f pos((this->owner)->getPosition()); + switch (kind) + { + case 1: + { + Bullet* bullet = new Bullet(pos.x, pos.y, 1);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet); + Sky::getInstance()->addMyBullet(bullet); + break; + } + case 2://ӵ + { + Bullet* bullet = new Bullet(pos.x+30, pos.y+30, 4);//1Լӵ2ǵ˵ӵ޸ + Sky::getInstance()->add(bullet); + Sky::getInstance()->addEnemyBullet(bullet); + Bullet* bullet2 = new Bullet(pos.x - 30, pos.y-30, 2 );//1Լӵ2ǵ˵ӵ޸ + Sky::getInstance()->add(bullet2); + Sky::getInstance()->addEnemyBullet(bullet2); + Bullet* bullet3 = new Bullet(pos.x , pos.y, 3);//1Լӵ2ǵ˵ӵ޸ + Sky::getInstance()->add(bullet3); + Sky::getInstance()->addEnemyBullet(bullet3); + + break; + } + case 3://ʬ + { + Bullet* bullet1 = new Bullet(pos.x + 100, pos.y, 6);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + Bullet* bullet2 = new Bullet(pos.x + 200, pos.y - 100, 6);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet2); + Sky::getInstance()->addEnemyBullet(bullet2); + Bullet* bullet3 = new Bullet(pos.x, pos.y, 2);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet3); + Sky::getInstance()->addEnemyBullet(bullet3); + Bullet* bullet4 = new Bullet(pos.x - 100, pos.y, 5);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet4); + Sky::getInstance()->addEnemyBullet(bullet4); + Bullet* bullet5 = new Bullet(pos.x + 200, pos.y - 100, 5);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet5); + Sky::getInstance()->addEnemyBullet(bullet5); + break; + } + case 4: {//Բӵ о + Bullet* bullet1 = new Bullet(pos.x + 100, pos.y, 6);//+15Ϊ˺ģЭ޸ģ + //bullet1->getpos(&hero); + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + break; + } + case 5: {//bossԲӵ bossһ׶εĵһֹ ٶ + Bullet* bullet1 = new Bullet(pos.x +10, pos.y, 8);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + Bullet* bullet2 = new Bullet(pos.x + 8.7, pos.y - 5.1, 9);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet2); + Sky::getInstance()->addEnemyBullet(bullet2); + Bullet* bullet3 = new Bullet(pos.x+5.1, pos.y-8.7, 10);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet3); + Sky::getInstance()->addEnemyBullet(bullet3); + Bullet* bullet4 = new Bullet(pos.x ,pos.y-10, 11);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet4); + Sky::getInstance()->addEnemyBullet(bullet4); + Bullet* bullet5 = new Bullet(pos.x -5.1, pos.y - 8.7, 12);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet5); + Sky::getInstance()->addEnemyBullet(bullet5); + Bullet* bullet6 = new Bullet(pos.x -8.7, pos.y-5.1, 13);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet6); + Sky::getInstance()->addEnemyBullet(bullet6); + Bullet* bullet7 = new Bullet(pos.x -10, pos.y , 14);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet7); + Sky::getInstance()->addEnemyBullet(bullet7); + Bullet* bullet8 = new Bullet(pos.x-8.7, pos.y+5.1, 15);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet8); + Sky::getInstance()->addEnemyBullet(bullet8); + Bullet* bullet9 = new Bullet(pos.x-5.1, pos.y+8.7, 16);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet9); + Sky::getInstance()->addEnemyBullet(bullet9); + Bullet* bullet10 = new Bullet(pos.x, pos.y + 10, 17);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet10); + Sky::getInstance()->addEnemyBullet(bullet10); + Bullet* bullet11 = new Bullet(pos.x + 5.1, pos.y +8.7, 18);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet11); + Sky::getInstance()->addEnemyBullet(bullet5); + Bullet* bullet12 = new Bullet(pos.x +8.7, pos.y +5.1, 19);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet12); + Sky::getInstance()->addEnemyBullet(bullet12); + + break; + } + case 6: + { + Bullet* bullet1 = new Bullet(pos.x+5.000000, pos.y+20.000000, 20); + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + Bullet* bullet2 = new Bullet(pos.x+0.000000, pos.y+20.000000, 21); + Sky::getInstance()->add(bullet2); + Sky::getInstance()->addEnemyBullet(bullet2); + Bullet* bullet3 = new Bullet(pos.x-5.000000, pos.y+20.000000, 22); + Sky::getInstance()->add(bullet3); + Sky::getInstance()->addEnemyBullet(bullet3); + Bullet* bullet4 = new Bullet(pos.x+4.000000, pos.y+15.000000, 23); + Sky::getInstance()->add(bullet4); + Sky::getInstance()->addEnemyBullet(bullet4); + Bullet* bullet5 = new Bullet(pos.x-4.000000, pos.y+15.000000, 24); + Sky::getInstance()->add(bullet5); + Sky::getInstance()->addEnemyBullet(bullet5); + Bullet* bullet6 = new Bullet(pos.x+0.000000, pos.y+10.000000, 25); + Sky::getInstance()->add(bullet6); + Sky::getInstance()->addEnemyBullet(bullet6); + Bullet* bullet7 = new Bullet(pos.x-2.500000, pos.y+10.000000, 26); + Sky::getInstance()->add(bullet7); + Sky::getInstance()->addEnemyBullet(bullet7); + break; + } + case 7://boss + { + for (int i = 0; i < 30; i++) + { + int a = rand() % 1024; + int b = rand() % 300; + int c = 27 + a % 2; + Bullet* bullet1 = new Bullet(a, b, c); + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + } + break; + } + case 8://һ׷ + { + for (int i = 0; i < 20;i++) + { + int a1 = 200+rand() % 500; + int b2 = rand() % 500; + Bullet* bullet1 = new Bullet(a1, b2, 29); + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addEnemyBullet(bullet1); + } + break; + } + } + /*} + else { + sf::Vector2f pos((this->owner)->getPosition()); + Bullet* bullet = new Bullet(pos.x + 15, pos.y + 15);//+15Ϊ˺ģЭ޸ģ + Sky::getInstance()->add(bullet); + Sky::getInstance()->addEnemyBullet(bullet); + }*/ +} +sf::Vector2f Gun::getPosition() { + sf::Vector2f ff; + return ff;//κβ +} +void Gun::setOwner(Plane* owner,int kind) { + this->owner = owner; + this->kind = kind; +} \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/Gun.h b/ConsoleApplication50/ConsoleApplication50/Gun.h new file mode 100644 index 00000000..9da044be --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Gun.h @@ -0,0 +1,18 @@ +#pragma once +#include +#include +class Plane; +class Gun +{ +public: + void setOwner(Plane* owner,int kind); + void fire(); +// Gun(int i) { + // this->kind = i; +// }; +private: + sf::Vector2f getPosition();//ʲô + Plane* owner; + int kind; +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Hero.cpp b/ConsoleApplication50/ConsoleApplication50/Hero.cpp new file mode 100644 index 00000000..2ea1be34 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Hero.cpp @@ -0,0 +1,65 @@ + +#include "stdafx.h" +#include "Hero.h" +#include"Texture.h" +Hero::~Hero() { + ; +} +Hero::Hero() +{ + HeroBomb = 1; + HeroDong = 0; + HeroPower = 0; + life = 20; + a.load(1); + this->setTexture(a.HERO);//ʲô˼ + this->setPosition(800, 600); + this->gun.setOwner(this,1);//ʲô˼ +} + +void Hero::move2left() { + if(this->getPosition().x-10>0) + this->move(-10, 0); +} +void Hero::move2leftslow() { + this->move(-3, 0); +} +void Hero::move2right() { + if((this->getPosition().x + 10)<1024) + this->move(10, 0); +} +void Hero::move2rightslow() { + this->move(3, 0); +} +void Hero::move2up() { + if((this->getPosition().y - 10)>0) + this->move(0, -10); +} +void Hero::move2upslow() { + this->move(0, -3); +} +void Hero::move2down() { + if((this->getPosition().y + 10)<768) + this->move(0, 10); +} +void Hero::move2downslow() { + this->move(0, 3); +} + +void Hero::bomblost() +{ + this->HeroBomb--; +} + +void Hero::dongTurnToPower() +{ + if (this->HeroDong > 20) { + this->HeroPower++; + this->HeroDong = 0; + } +} + +bool Hero::havebomb() +{ + return HeroBomb; +} diff --git a/ConsoleApplication50/ConsoleApplication50/Hero.h b/ConsoleApplication50/ConsoleApplication50/Hero.h new file mode 100644 index 00000000..3918f062 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Hero.h @@ -0,0 +1,33 @@ +#pragma once //ֹض +#include +#include"Plane.h" +#include"Sprite.h"//ǷҪ +#include"Texture.h" +class Hero:public Plane +{ +public: + Hero(); + ~Hero(); + void move2left(); + void move2leftslow(); + void move2rightslow(); + void move2right(); + void move2up(); + void move2upslow(); + void move2down(); + void move2downslow(); + void bomblost(); + void dongTurnToPower(); + bool havebomb(); + sf::Clock clockWD; + sf::Time t5 = sf::seconds(5); + int life; + int HeroDong; + int HeroPower; + int whetherWD = 0;//Ƿ޵ + int HeroBomb;//ЩĺҪʵҪΪprivate +private: + Texture a; + +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.cpp b/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.cpp new file mode 100644 index 00000000..071982a6 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.cpp @@ -0,0 +1,23 @@ +#include "stdafx.h" +#include "LaunchToolPoint.h" +#include"Plane.h" +#include"ToolPoint.h" +#include"Sky.h" +void LaunchToolPoint::launch() { + sf::Vector2f pos((this->owner)->getPosition());// + ToolPoint* toolpoint = new ToolPoint(pos.x, pos.y); + Sky::getInstance()->add(toolpoint); + Sky::getInstance()->addToolPoint(toolpoint); +} +void LaunchToolPoint::setOwner(Plane* owner) {//һνownerotherûиеownerֵ + this->owner = owner;//飺λóͻ ԰Plane* ownerPlane* other, +} +sf::Vector2f LaunchToolPoint::getPosition() { + sf::Vector2f ff; + return ff; +} + + + + + diff --git a/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.h b/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.h new file mode 100644 index 00000000..f3924959 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/LaunchToolPoint.h @@ -0,0 +1,17 @@ +#pragma once +#include +#include +class Plane; +class LaunchToolPoint +{ +public: + void setOwner(Plane*); + void launch(); +private: + sf::Vector2f getPosition(); + Plane* owner; +}; + + + + diff --git a/ConsoleApplication50/ConsoleApplication50/Plane.cpp b/ConsoleApplication50/ConsoleApplication50/Plane.cpp new file mode 100644 index 00000000..4d9b7178 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Plane.cpp @@ -0,0 +1,9 @@ +#include "stdafx.h" +#include "Plane.h" +void Plane::fire() { + this->gun.fire(); +} +void Plane::launch() { + this->launchtoolpoint.launch(); +} + diff --git a/ConsoleApplication50/ConsoleApplication50/Plane.h b/ConsoleApplication50/ConsoleApplication50/Plane.h new file mode 100644 index 00000000..93003d1e --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Plane.h @@ -0,0 +1,16 @@ +#pragma once +#include +#include"Sound.h" +#include"Gun.h" +#include"LaunchToolPoint.h" +#include +#include"Sprite.h" +class Plane:public Sprite{ +public: + void fire(); + void launch(); +protected: + Gun gun; + LaunchToolPoint launchtoolpoint; +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Ppoint.JPG b/ConsoleApplication50/ConsoleApplication50/Ppoint.JPG new file mode 100644 index 00000000..b2c4dcc9 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/Ppoint.JPG differ diff --git a/ConsoleApplication50/ConsoleApplication50/ReadMe.txt b/ConsoleApplication50/ConsoleApplication50/ReadMe.txt new file mode 100644 index 00000000..65bd4cad --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ReadMe.txt @@ -0,0 +1,30 @@ +======================================================================== + 控制台应用程序:ConsoleApplication50 项目概述 +======================================================================== + +应用程序向导已为您创建了此 ConsoleApplication50 应用程序。 + +本文件概要介绍组成 ConsoleApplication50 应用程序的每个文件的内容。 + + +ConsoleApplication50.vcxproj + 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 + +ConsoleApplication50.vcxproj.filters + 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 + +ConsoleApplication50.cpp + 这是主应用程序源文件。 + +///////////////////////////////////////////////////////////////////////////// +其他标准文件: + +StdAfx.h, StdAfx.cpp + 这些文件用于生成名为 ConsoleApplication50.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 + +///////////////////////////////////////////////////////////////////////////// +其他注释: + +应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 + +///////////////////////////////////////////////////////////////////////////// diff --git a/ConsoleApplication50/ConsoleApplication50/Sky.cpp b/ConsoleApplication50/ConsoleApplication50/Sky.cpp new file mode 100644 index 00000000..1d15bf05 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sky.cpp @@ -0,0 +1,358 @@ +#include "stdafx.h" +#include "Sky.h" +#include"Enemy.h" +#include"Texture.h" +//ʵʡ + +Sky* Sky::instance = nullptr; +//ʵ +Sky::Sky() {// + stageofsky = 0; + this->window = new sf::RenderWindow(sf::VideoMode(1224, 768), "1"); +} + //ʲô˼ +/*sf::Image icon; +if (icon.loadFromFile(path)) +{ + this->window->setIcon(icon.getSize().x, icon.getSie().y, icon.getPixelsPtr()); +} +this->background = new sf::Sprite(Texture::SKY); +}//ͼꣿΪʲôbackgroundָ룿*/ +void Sky::add(Sprite* sprite) { + this->sprites.insert(sprite); +} +void Sky::addMyBullet(Bullet* bullet) { + this->myBullets.insert(bullet); +} +void Sky::addEnemyBullet(Bullet *bullet) +{ + this->enemyBullets.insert(bullet); +} +void Sky::addToolPoint(ToolPoint* toolpoint) { + this->toolPoints.insert(toolpoint); +} +void Sky::refresh() {//ҪӳԵdongturntopowerʵ + //this->window->draw(*this->background);//drawʲôΪʲôthisǰҪָ룬windowʲô + if (stageofsky == 0) { + this->window->clear(); + this->clear(); + this->collision();//collisionʲô 𰸣ײ + this->createEnemies(); + for (auto &sprite : this->sprites) {// + sprite->heartBeat();//ĸ 𰸣ڼ㼦· + this->window->draw(*sprite); + } + this->window->display(); + } + else { + ;//˴bossս; + if (!this->whethercreateboss) { + createBoss(); + whethercreateboss = 1; + } + //std::cout << "A"; + this->clearbossfight(); + this->collisionbossfight(); + this->window->clear(); + for (auto &sprite : this->sprites) {// + sprite->heartBeat();//ĸ 𰸣ڼ㼦· + this->window->draw(*sprite);//ͼ + } + this->window->display(); + } +} +void Sky::bombclear() +{ + for (auto it_enemy = this->enemies.begin(); it_enemy != this->enemies.end();) { + { + delete *it_enemy;//С + this->sprites.erase(*it_enemy);//ʲô... + it_enemy = (this->enemies).erase(it_enemy); + } + } + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) { + { + delete *it_enemybullet;//С + this->sprites.erase(*it_enemybullet);//ʲô... + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + } +} +void Sky::whetherIdied(Hero* hero) {//һʼˣΪͷļcppļ + if (hero->whetherWD==0) { + if (this->whethercreateboss == 0) {//Ϊbossսͨ + for (auto it_enemy = this->enemies.begin(); it_enemy != this->enemies.end(); ++it_enemy) { + if ((*it_enemy)->intersects(hero)) + { + if ((hero->life) > 0) { + hero->life--; + hero->setPosition(512, 768); + hero->whetherWD = 1; + hero->clockWD.restart(); + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) { + // + delete *it_enemybullet; + this->sprites.erase(*it_enemybullet); + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + } + else + { + this->clear();//򣬲ҳ Ľ + } + + } + } + } + else { + auto it_boss = booss; + if ((it_boss)->intersects(hero)) + { + if ((hero->life) > 0) { + hero->life--; + hero->setPosition(512, 768); + hero->whetherWD = 1; + hero->clockWD.restart(); + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) { + // + delete *it_enemybullet; + this->sprites.erase(*it_enemybullet); + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + } + } + + } + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end(); ++it_enemybullet) { + if ((*it_enemybullet)->intersects(hero)) + { + if ((hero->life) > 0) { + hero->life--;//һõλã4s޵ + hero->setPosition(512,768); + hero->whetherWD = 1; + hero->clockWD.restart(); + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) { + // + delete *it_enemybullet; + this->sprites.erase(*it_enemybullet); + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + break; + } + else + { + this->clear();//򣬲ҳ Ľ + } + + } + } + } + else + { + if (hero->clockWD.getElapsedTime() >= t5) + hero->whetherWD = 0; + } +} +void Sky::whetherIgetDong(Hero * hero) +{ + for (auto it_toolpoint = this->toolPoints.begin(); it_toolpoint != this->toolPoints.end(); ++it_toolpoint) { + if ((*it_toolpoint)->intersects(hero)) { + delete *it_toolpoint; + this->sprites.erase(*it_toolpoint); + (this->toolPoints).erase(it_toolpoint); + hero->HeroDong++; + break; + } + } +} +void Sky::clear() {//ӵ + for (auto it_mybullet = this->myBullets.begin(); it_mybullet != this->myBullets.end();) + if ((*it_mybullet)->getPosition().y < 0 || (*it_mybullet)->getPosition().x < 0 || (*it_mybullet)->getPosition().x>1024 || (*it_mybullet)->getPosition().y >768) {//Կдneed clear + delete *it_mybullet;//оSTLı + this->sprites.erase(*it_mybullet); + it_mybullet = (this->myBullets).erase(it_mybullet); + }//ȴit_mybullet++forߣ̽ΪʲôͬʱڴռúͿĹϵ(Ϊӵʹڴһֱ߻Dz,ûӵڴȴ + else + it_mybullet++;//˴ϲټ + for (auto it_enemy = this->enemies.begin(); it_enemy != this->enemies.end();) { + if ((*it_enemy)->needClear()) { + delete *it_enemy;//С + this->sprites.erase(*it_enemy);//ʲô... + it_enemy = (this->enemies).erase(it_enemy); + } + else { + ++it_enemy; + } + } + for (auto it_toolpoint = this->toolPoints.begin(); it_toolpoint != this->toolPoints.end();) + if ((*it_toolpoint)->getPosition().y < 0 || (*it_toolpoint)->getPosition().x < 0 || (*it_toolpoint)->getPosition().x>1024 || (*it_toolpoint)->getPosition().y >768) {//Կдneed clear + delete *it_toolpoint;//оSTLı 󣺵һΰѻд + this->sprites.erase(*it_toolpoint); + it_toolpoint = (this->toolPoints).erase(it_toolpoint); + }//ȴit_mybullet++forߣ̽ΪʲôͬʱڴռúͿĹϵ(Ϊӵʹڴһֱ߻Dz,ûӵڴȴ + else + it_toolpoint++;//˴ϲټ + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) + if ((*it_enemybullet)->getPosition().x < 0 || (*it_enemybullet)->getPosition().y < 0 || (*it_enemybullet)->getPosition().x > 1024 || (*it_enemybullet)->getPosition().y>768) + { + delete *it_enemybullet; + this->sprites.erase(*it_enemybullet); + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + else + it_enemybullet++; +} +void Sky::clearbossfight()//ֻҪԼӵ +{ + for (auto it_mybullet = this->myBullets.begin(); it_mybullet != this->myBullets.end();) + if ((*it_mybullet)->getPosition().y < 0 || (*it_mybullet)->getPosition().x < 0 || (*it_mybullet)->getPosition().x>1024 || (*it_mybullet)->getPosition().y >768) {//Կдneed clear + delete *it_mybullet;//оSTLı + this->sprites.erase(*it_mybullet); + it_mybullet = (this->myBullets).erase(it_mybullet); + }//ȴit_mybullet++forߣ̽ΪʲôͬʱڴռúͿĹϵ(Ϊӵʹڴһֱ߻Dz,ûӵڴȴ + else + it_mybullet++;// + for (auto it_enemybullet = this->enemyBullets.begin(); it_enemybullet != this->enemyBullets.end();) + { + if ((*it_enemybullet)->getPosition().x < 0 || (*it_enemybullet)->getPosition().y < 0 || (*it_enemybullet)->getPosition().x > 1024 || (*it_enemybullet)->getPosition().y>768) + { + delete *it_enemybullet;//С + this->sprites.erase(*it_enemybullet);//ʲô... + it_enemybullet = (this->enemyBullets).erase(it_enemybullet); + } + else + { + it_enemybullet++; + } + } +} +void Sky::collision() {//ײ + for (auto it_enemy = this->enemies.begin(); it_enemy != this->enemies.end(); ++it_enemy) { + if ((*it_enemy)->isDead())//޸isdeadĶ첻ͬ˵Ѫ + { + //(*it_enemy)->state++; + continue;// + } + for (auto it_bullet = this->myBullets.begin(); it_bullet != this->myBullets.end(); ++it_bullet) { + if ((*it_enemy)->intersects(*it_bullet)) { + delete *it_bullet; + this->sprites.erase(*it_bullet); + (this->myBullets).erase(it_bullet); + (*it_enemy)->hit(); + break; + } + }//ÿһɻǷᱻÿһӵ + } + + + } + +void Sky::collisionbossfight() +{ + auto it_boss = booss; + for (auto it_bullet = this->myBullets.begin(); it_bullet != this->myBullets.end(); ++it_bullet) { + if ((*it_bullet)->intersects(it_boss)) {//ʲôʱָţʲôʱ򲻼 + delete *it_bullet; + this->sprites.erase(*it_bullet); + (this->myBullets).erase(it_bullet); + it_boss->hit(); + break; + } + } +} + + +void Sky::createEnemies(){ + if (whethersetenemyclock == 0) + { + clock1.restart(); + this->whethersetenemyclock = 1; + } + static int count = 0;//֡ʵַ޸ + switch (enemystage) + { + case 0: + if (clock1.getElapsedTime()<= t15) + {//һ׶γʱ + if (++count >= 60) + { + Enemy* enemy = new Enemy(2);//ʵenemyʱԶ + this->sprites.insert(enemy); + this->enemies.insert(enemy); + count = 0;//Ƶ + } + } + else + { + enemystage++; + clock1.restart(); + } + break; + case 1: + { + if (clock1.getElapsedTime() <= t5) + { + if (++count >= 60) + { + Enemy* enemy = new Enemy(3);//ʵenemyʱԶ + this->sprites.insert(enemy); + this->enemies.insert(enemy); + count = 0;//Ƶ + } + } + else + { + enemystage++; + clock1.restart(); + } + break; + } + case 2: + { + if (clock1.getElapsedTime() <= t15) + { + if (++count > 50) + { + Enemy* enemy = new Enemy(2);//ʵenemyʱԶ + this->sprites.insert(enemy); + this->enemies.insert(enemy); + Enemy* enemy1 = new Enemy(3);//ʵenemyʱԶ + this->sprites.insert(enemy1); + this->enemies.insert(enemy1); + count = 0;//Ƶ + } + } + else + { + enemystage++; + clock1.restart(); + } + break; + + } + case 3://ȼڶ׶νbossսֳ + { + if (enemies.empty() && enemies.empty() && toolPoints.empty()) + this->stageofsky = 1; + break; + } + break; + } + +} + + +void Sky::createBoss() +{ + Boss* boss = new Boss; + std::cout << "B"; + this->sprites.insert(boss); + this->booss = boss;// +} +Sky* Sky::getInstance() { + if (!instance) {//ʲô˼ + instance = new Sky; + } + return instance; +} + diff --git a/ConsoleApplication50/ConsoleApplication50/Sky.h b/ConsoleApplication50/ConsoleApplication50/Sky.h new file mode 100644 index 00000000..3b92254e --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sky.h @@ -0,0 +1,55 @@ +#pragma once +#include +#include"Sprite.h" +#include"Enemy.h" +#include"Bullet.h" +#include +#include"Hero.h" +#include"ToolPoint.h" +#include"Boss.h" +#include +using namespace std; +class Sky +{ +public://ʵ:ȡheroλ +static Sky* getInstance();//sfָΪ̬ + sf::RenderWindow* getWindow() { + return this->window; + }//ʵִڵķ + void add(Sprite* sprite);//ΪԪ + void addMyBullet(Bullet*);//ӵ + void addEnemyBullet(Bullet*); + void addToolPoint(ToolPoint*); + void refresh();// + void bombclear(); + void whetherIdied(Hero* hero); + void whetherIgetDong(Hero* hero);//жǷõ˶ +private: + Sky(); + sf::RenderWindow* window; + unordered_set sprites; + unordered_set enemies; + unordered_set myBullets; + unordered_setenemyBullets; + unordered_set toolPoints; + //unordered_setbooss; + Boss* booss; + sf::Sprite* background = nullptr; + static Sky*instance; + void clear(); + void clearbossfight(); + void collision(); + void collisionbossfight(); + void createEnemies(); + void createBoss(); + sf::Time t20 = sf::seconds(20);//20s + sf::Time t15 = sf::seconds(15); + sf::Time t30 = sf::seconds(30); + sf::Time t5 = sf::seconds(5); + sf::Clock clock1; + int stageofsky;//׶ΣΪ0ʱС֣Ϊ1ʱboss + int enemystage=0;//СֵĽ׶Σʱij10 + int whethercreateboss = 0;//Ƿboss ıȥһ + int whethersetenemyclock = 0;//СãΪ0ûùclock1 +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Sound.cpp b/ConsoleApplication50/ConsoleApplication50/Sound.cpp new file mode 100644 index 00000000..dea0ff85 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sound.cpp @@ -0,0 +1,8 @@ +#include "stdafx.h" +#include "Sound.h" +sf::Music Sound::BACK_GROUND; +sf::Music Sound::ENEMY_DOWN; +void Sound::load() { + BACK_GROUND.openFromFile("th.mp3"); + ENEMY_DOWN.openFromFile("th3.m4a"); +} \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/Sound.h b/ConsoleApplication50/ConsoleApplication50/Sound.h new file mode 100644 index 00000000..6a0d73c6 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sound.h @@ -0,0 +1,8 @@ +#pragma once +#include +class Sound { +public: + static sf::Music BACK_GROUND; + static sf::Music ENEMY_DOWN; + static void load(); +}; \ No newline at end of file diff --git a/ConsoleApplication50/ConsoleApplication50/Sprite.cpp b/ConsoleApplication50/ConsoleApplication50/Sprite.cpp new file mode 100644 index 00000000..533ad32d --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sprite.cpp @@ -0,0 +1,11 @@ +#include "stdafx.h" +#include "Sprite.h" +#include "Sky.h" +#include "Enemy.h" +void Sprite::draw(){ + Sky::getInstance()->getWindow()->draw(*this); +} +bool Sprite::intersects(Sprite* other) { + bool t = this->getGlobalBounds().intersects(other->getGlobalBounds());//ʲô˼ + return t;//getGlobalBounds ʲô +} diff --git a/ConsoleApplication50/ConsoleApplication50/Sprite.h b/ConsoleApplication50/ConsoleApplication50/Sprite.h new file mode 100644 index 00000000..45797a1d --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Sprite.h @@ -0,0 +1,11 @@ +#pragma once +#include +#include +class Sprite:public sf::Sprite//Ժsprite +{ +public: + virtual void heartBeat() {};//ʲôã + void draw(); + bool intersects(Sprite* other); +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/Texture.cpp b/ConsoleApplication50/ConsoleApplication50/Texture.cpp new file mode 100644 index 00000000..d1df4a48 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Texture.cpp @@ -0,0 +1,65 @@ +#include "stdafx.h" +#include "texture.h"//ڶȡ + +void Texture::load(int i) { + switch (i) + { + case 1: { + HERO.loadFromFile("hero.png"); + break; + } + case 2: { + ENEMY1.loadFromFile("enemy1.png"); + break; + } + case 3: { + ENEMY_DOWN_1.loadFromFile("4.png"); + break; + } + case 4: { + ENEMY_DOWN_2.loadFromFile("4.png"); + break; } + case 5: { + ENEMY_DOWN_3.loadFromFile("4.png"); + break; + } + case 6: { + ENEMY_DOWN_4.loadFromFile("4.png"); + break; + } + case 7: { + BULLET.loadFromFile("4.png"); + break; } + case 8: { + SKY.loadFromFile("4.png"); + break; + } + case 9:{ + DONGPOINT.loadFromFile("dongpoint.png"); + break; + } + case 10: { + POWERPOINT.loadFromFile("4.png"); + break; + } + case 11: { + ENEMY2.loadFromFile("enemytype2.png"); + break; + } + case 12: { + ENEMYBULLET.loadFromFile("enemybullet.png"); + break; + } + case 13: { + BOSS.loadFromFile("boss.png");//޸IJ + break; + } + case 14: { + LIGHT.loadFromFile("light.png"); + } + break; + + } +} + + diff --git a/ConsoleApplication50/ConsoleApplication50/Texture.h b/ConsoleApplication50/ConsoleApplication50/Texture.h new file mode 100644 index 00000000..1a894f90 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/Texture.h @@ -0,0 +1,22 @@ +#pragma once +#include +//#include +class Texture { +public: + sf::Texture HERO; + sf::Texture ENEMY1; + sf::Texture ENEMY2; + sf::Texture ENEMY_DOWN_1; + sf::Texture ENEMY_DOWN_2; + sf::Texture ENEMY_DOWN_3; + sf::Texture ENEMY_DOWN_4; + sf::Texture BULLET; + sf::Texture SKY; + sf::Texture DONGPOINT; + sf::Texture POWERPOINT; + sf::Texture ENEMYBULLET; + sf::Texture BOSS; + sf::Texture LIGHT; + void load(int i); + Texture() {}; +};//ϰ̬ diff --git a/ConsoleApplication50/ConsoleApplication50/ToolPoint.cpp b/ConsoleApplication50/ConsoleApplication50/ToolPoint.cpp new file mode 100644 index 00000000..c5c98a4b --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ToolPoint.cpp @@ -0,0 +1,13 @@ +#include "stdafx.h" +#include "ToolPoint.h" +void ToolPoint::heartBeat() +{ + this->move(0, 5); +} + +ToolPoint::ToolPoint(float x,float y) +{ + A.load(9); + this->setTexture(A.DONGPOINT); + this->setPosition(x, y); +} diff --git a/ConsoleApplication50/ConsoleApplication50/ToolPoint.h b/ConsoleApplication50/ConsoleApplication50/ToolPoint.h new file mode 100644 index 00000000..745657b0 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/ToolPoint.h @@ -0,0 +1,13 @@ +#pragma once +#include"Plane.h" +#include"Texture.h" +#include"Bullet.h" +class ToolPoint:public Plane +{ +public: + void heartBeat(); + ToolPoint(float x, float y); +private: + Texture A;//߲ +}; + diff --git a/ConsoleApplication50/ConsoleApplication50/boss.png b/ConsoleApplication50/ConsoleApplication50/boss.png new file mode 100644 index 00000000..b305b1c2 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/boss.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/dongpoint.png b/ConsoleApplication50/ConsoleApplication50/dongpoint.png new file mode 100644 index 00000000..c988c821 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/dongpoint.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/enemy1.png b/ConsoleApplication50/ConsoleApplication50/enemy1.png new file mode 100644 index 00000000..6c1faa78 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/enemy1.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/enemybullet.png b/ConsoleApplication50/ConsoleApplication50/enemybullet.png new file mode 100644 index 00000000..1b3bd6d8 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/enemybullet.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/enemytype2.png b/ConsoleApplication50/ConsoleApplication50/enemytype2.png new file mode 100644 index 00000000..092534bd Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/enemytype2.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/hero.png b/ConsoleApplication50/ConsoleApplication50/hero.png new file mode 100644 index 00000000..3b9139ed Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/hero.png differ diff --git a/ConsoleApplication50/ConsoleApplication50/resource.h b/ConsoleApplication50/ConsoleApplication50/resource.h new file mode 100644 index 00000000..c106af7b --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by ConsoleApplication50.rc + +// ¶һĬֵ +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/ConsoleApplication50/ConsoleApplication50/stdafx.cpp b/ConsoleApplication50/ConsoleApplication50/stdafx.cpp new file mode 100644 index 00000000..7742bc78 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : ֻ׼ļԴļ +// ConsoleApplication50.pch ΪԤͷ +// stdafx.obj ԤϢ + +#include "stdafx.h" + +// TODO: STDAFX.H κĸͷļ +//ڴļ diff --git a/ConsoleApplication50/ConsoleApplication50/stdafx.h b/ConsoleApplication50/ConsoleApplication50/stdafx.h new file mode 100644 index 00000000..baa4bbc6 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : ׼ϵͳļİļ +// Ǿʹõĵ +// ضĿİļ +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: ڴ˴óҪͷļ diff --git a/ConsoleApplication50/ConsoleApplication50/targetver.h b/ConsoleApplication50/ConsoleApplication50/targetver.h new file mode 100644 index 00000000..416cebf8 --- /dev/null +++ b/ConsoleApplication50/ConsoleApplication50/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// SDKDDKVer.h õ߰汾 Windows ƽ̨ + +// ҪΪǰ Windows ƽ̨Ӧó WinSDKVer.h +// _WIN32_WINNT ΪҪֵ֧ƽ̨Ȼٰ SDKDDKVer.h + +#include diff --git a/ConsoleApplication50/ConsoleApplication50/th.mp3 b/ConsoleApplication50/ConsoleApplication50/th.mp3 new file mode 100644 index 00000000..f73f6227 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/th.mp3 differ diff --git a/ConsoleApplication50/ConsoleApplication50/th3.m4a b/ConsoleApplication50/ConsoleApplication50/th3.m4a new file mode 100644 index 00000000..3cab3d72 Binary files /dev/null and b/ConsoleApplication50/ConsoleApplication50/th3.m4a differ diff --git a/ConsoleApplication50/Debug/ConsoleApplication50.exe b/ConsoleApplication50/Debug/ConsoleApplication50.exe new file mode 100644 index 00000000..3b7aa483 Binary files /dev/null and b/ConsoleApplication50/Debug/ConsoleApplication50.exe differ diff --git a/ConsoleApplication50/Debug/ConsoleApplication50.ilk b/ConsoleApplication50/Debug/ConsoleApplication50.ilk new file mode 100644 index 00000000..59ac078a Binary files /dev/null and b/ConsoleApplication50/Debug/ConsoleApplication50.ilk differ diff --git a/ConsoleApplication50/Debug/ConsoleApplication50.pdb b/ConsoleApplication50/Debug/ConsoleApplication50.pdb new file mode 100644 index 00000000..b36ddf41 Binary files /dev/null and b/ConsoleApplication50/Debug/ConsoleApplication50.pdb differ diff --git a/ConsoleApplication50/ipch/CONSOLEAPPLICATION50-cf5c7f8f/CONSOLEAPPLICATION50-d19640f8.ipch b/ConsoleApplication50/ipch/CONSOLEAPPLICATION50-cf5c7f8f/CONSOLEAPPLICATION50-d19640f8.ipch new file mode 100644 index 00000000..b0f82e39 Binary files /dev/null and b/ConsoleApplication50/ipch/CONSOLEAPPLICATION50-cf5c7f8f/CONSOLEAPPLICATION50-d19640f8.ipch differ diff --git "a/ConsoleApplication50/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" "b/ConsoleApplication50/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" new file mode 100644 index 00000000..7a26594d --- /dev/null +++ "b/ConsoleApplication50/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" @@ -0,0 +1,28 @@ +1>------ 已启动生成: 项目: ConsoleApplication50, 配置: Debug Win32 ------ +1> Sky.cpp +1> 正在生成代码... +1> 正在编译... +1> Sprite.cpp +1> LaunchToolPoint.cpp +1> Gun.cpp +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(61): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(64): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(70): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(73): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(79): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(82): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(88): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(91): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(99): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(102): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(105): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(108): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(111): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(114): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(117): warning C4244: “参数”: 从“double”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(129): warning C4244: “参数”: 从“int”转换到“float”,可能丢失数据 +1>c:\users\hj\documents\visual studio 2015\projects\consoleapplication50\consoleapplication50\gun.cpp(141): warning C4244: “参数”: 从“int”转换到“float”,可能丢失数据 +1> ConsoleApplication50.cpp +1> 正在生成代码... +1> ConsoleApplication50.vcxproj -> C:\Users\hj\documents\visual studio 2015\Projects\ConsoleApplication50\Debug\ConsoleApplication50.exe +========== 生成: 成功 1 个,失败 0 个,最新 0 个,跳过 0 个 ========== diff --git a/myreport.md b/myreport.md new file mode 100644 index 00000000..a22d0cd7 --- /dev/null +++ b/myreport.md @@ -0,0 +1,40 @@ +### 实验报告 + +#### 关于内容 +1.本游戏的目标人群 + +* 本游戏是单人游戏,主打的是密集子弹下玩家进行躲避,没有多人内容 + +2.游戏的基本规则 + +* 游戏全程共一关,分为boss战和道中,关卡的推进与时间相关。规则与基本打飞机规则一致,敌人有血量设定,玩家只要被子弹击中一次或是与小怪接触便减少一点生命值,初始生命值一共3点,全部失去后死亡。 +* 玩家子弹威力不会升级,但是拥有bomb,每次使用bomb会消去全屏的子弹和小怪,并且使用bomb和死亡复活时会获得4s的无敌时间 + +##### 小怪阶段 +* 小怪阶段可分为两个小阶段,第一阶段有在一定高度随机横着出现并沿直线飞过屏幕的发射三枚子弹的小怪,击杀此类小怪可以获得道具“点”,唯一的作用是增加游戏分数,第二阶段增加了竖着坠落的死尸小怪,死尸小怪只有一血,如果不攻击只有碰撞判定。若击杀则会发射5颗子弹,并且沿着y轴方向的子弹弹速较快,难以躲避。两个阶段分别持续一段固定的时间 + +##### Boss战阶段 +* boss出现时将等待10s用于使得出界的子弹消失 +* boss的第一阶段将会发射圆形的子弹,并且自身会进行倒三角形移动,避免玩家站着不动就可以躲开子弹情况 +* boss的第二阶段仍然会发射圆形子弹,但是因为发射时自身的位置在一定区域内随机出现且发射频率较高,所以会比较难以躲避。且看起来比较杂乱 +* boss的第三阶段是在比较低的位置发射大量的随机子弹(数目固定,且子弹下一过程中轨迹也是随机的,boss本身也会不停的从屏幕左边移动到屏幕的右边。 +#### 关于以上想法的实现 +##### 材料 +* 使用了sfml中的audio,graphics,system几个库 +##### 环境的配置 +* 配置环境:按照SFML官方教程配置就可以,配置过程中遇到的问题是对于同一个类型的功能(如Audio),有一些库是用来debug模式的,有一些是用来其他模式下用的,如果混用就会发生类似“无法解释的外部名称”这种报错类型。在配置的过程中花了一番功夫。 +#### 自我评价 +* 关于帧数:我采用了setframe这个函数,并且设置为了100,在实现初期因为没有清理出界的sprite和enemy和bullet,导致了内存在持续上升(从任务管理器观测),玩一段时间以后便出现了效能问题。在后期清理出界元素以后情况好转了一些,在boss战的时候后子弹虽然增长了许多,但是由于碰撞判定的简化和不再需要判定吃道具,帧数依然可以得到保证 +* 关于游戏界面和图形和音乐:由于我没有比较好的图像处理软件(抠图用的是美图秀秀...),而且改游戏的核心在于子弹的设计。所以界面非常简单。甚至取消了背景 +* 运行界面截图 +* 希望改进的部分: + 1. 更加美观的页面,由于期末和六级的原因我已经没有时间实现了 + 2. 更多的关卡,由于对const的理解不够深刻,我们没有实现我想实现的最后一个关卡。而且我本来想实现更多的关卡 + 3. 使用圆形碰撞判定,由于考虑到效率问题,我采用了sfml自带的方向判定(事实上本类游戏的特点便是判定点远远小于自身的贴图大小,否则在密集子弹下无法存活,由于时间问题我担心做好以后发现有效能问题,最后没有时间调试,所以我采用了sfml自带的碰撞判定 + +#### 收获 +* 环境的搭配:我感觉环境的搭配实在是太麻烦了,出现了很多我没想到过的错误。。。而且难以解决,要说解决方法还是直接问别人吧,我在环境的搭配上花费了不少时间。 +* 面向对象编程:在最初我做这个项目的时候用的还是c语言的思想,最初主要在main函数里写了大量内容,并且考虑使用结构体,但是看了example以后我感觉用c++写这种比较大的项目真是太好了...功能之间的关系都很明朗,不过类之间通信比较麻烦,因为我是在想不到什么方法可以把hero的position传到bullet那个类里面(如果可以这么做,可以实现指向自机的子弹)(虽然可以通过把自机的位置作为参数传递给bullet这个类,使得最初设置位置的时候可以设置成指向自机,但是这太麻烦了。我问了其他人好想是应当把这个自机的位置设置为静态变量,但是似乎在vs里面把sf类里的一些结构设置为全局变量和静态变量都会出很多问题。所以最后我放弃了 +* vs的使用:在这个项目里边真的用到了很多的类,而且每个类的成员函数非常多,我感觉到后面我发现很多vs的功能还是很实用的,像是用F12找定义位置,创建成员函数以后直接用Ctrl+.来描述这个函数。 +* 另外还积累了很多vs报错的原因,现在看到vs的有些报错大致能猜到是出了什么小问题(像少了个大括号或者是调用函数忘记加括号了 +* 在实现圆形子弹我要写很多重复的内容,于是我用到了前半个学期学的文件输入输出的方法写了小程序帮助我写一些重复度很高的内容,我感觉以后可能也要用到这个技巧。 diff --git a/practices/level1/Queue/Queue.cpp b/practices/level1/Queue/Queue.cpp new file mode 100644 index 00000000..0d189a43 --- /dev/null +++ b/practices/level1/Queue/Queue.cpp @@ -0,0 +1,16 @@ +#include "stdafx.h" +#include "Queue.h" +void Queue::append(int item) { + data[head] = item; + head = (head + 1) % 100; +} +int Queue::pop() { + tail = (tail + 1) % 100; + return data[tail - 1]; +} +bool Queue::isEmpty() { + return (head == tail); +}; +bool Queue::isFull() { + return ((head + 1) % 100 == tail); +}; diff --git a/practices/level1/Queue/Queue.h b/practices/level1/Queue/Queue.h new file mode 100644 index 00000000..eb29b808 --- /dev/null +++ b/practices/level1/Queue/Queue.h @@ -0,0 +1,12 @@ +#pragma once +class Queue { +public: + void append(int item); + int pop(); + bool isEmpty(); + bool isFull(); +private: + int data[100]; + int head = 0; + int tail = 0; +}; \ No newline at end of file diff --git a/practices/level1/Queue/Queue1.cpp b/practices/level1/Queue/Queue1.cpp new file mode 100644 index 00000000..d6e748f1 --- /dev/null +++ b/practices/level1/Queue/Queue1.cpp @@ -0,0 +1,17 @@ +// Queue1.cpp : ̨Ӧóڵ㡣 +// + +#include "stdafx.h" +#include +#include"Queue.h" +using namespace std; +int main() +{ + Queue a; + for (int i = 0; i < 100; i++) + a.append(i); + for (int i = 0; i < 100; i++) + cout << a.pop(i); + return 0; +} + diff --git a/practices/level1/p01_runningLetter/1.cpp.txt b/practices/level1/p01_runningLetter/1.cpp.txt new file mode 100644 index 00000000..4de6821a --- /dev/null +++ b/practices/level1/p01_runningLetter/1.cpp.txt @@ -0,0 +1,17 @@ +#include +#include +#include +#define X 158 +int main() +{ + for (int i = 1; i <= X; i++) + { + printf("a"); + system("cls"); + for (int j = 1; j <= (79-abs(79-i));j++) + printf(" "); + } + + return 0; +} + diff --git a/practices/level1/p01_runningLetter/p1.cpp b/practices/level1/p01_runningLetter/p1.cpp new file mode 100644 index 00000000..13ce1b53 --- /dev/null +++ b/practices/level1/p01_runningLetter/p1.cpp @@ -0,0 +1,17 @@ +// ConsoleApplication44.cpp : ̨Ӧóڵ㡣 +// +#include +#include +#include +#define double_len_of_console 158 +int main(){ + for (int i = 1; i <= double_len_of_console; i++){ + printf("a"); + system("cls"); + for (int j = 1; j <= (79 - abs(79 - i)); j++) + printf(" "); + } + + return 0; +} + diff --git a/practices/level1/p02_isPrime/2.cpp.txt b/practices/level1/p02_isPrime/2.cpp.txt new file mode 100644 index 00000000..e3efbb73 --- /dev/null +++ b/practices/level1/p02_isPrime/2.cpp.txt @@ -0,0 +1,21 @@ +#include +int main() +{ + int n, ye = 1; + scanf("%d", &n); + for (int q = 2; q*q <= n; q++) + { + if (n%q == 0) + { + ye = 0; + break; + } + } + if (ye == 1) + printf("isprime\n"); + else + printf(":(\n"); + return 0; + +} + diff --git a/practices/level1/p02_isPrime/p2.cpp b/practices/level1/p02_isPrime/p2.cpp new file mode 100644 index 00000000..bfed4ce0 --- /dev/null +++ b/practices/level1/p02_isPrime/p2.cpp @@ -0,0 +1,19 @@ +#include +int main() { + int n, yes = 1; + scanf("%d", &n); + for (int q = 2; q*q <= n; q++) { + if (n%q == 0) + { + yes = 0; + break; + } + } + if (yes == 1) + printf("isprime\n"); + else + printf(":(\n"); + return 0; + +} + diff --git a/practices/level1/p03_Diophantus/3.cpp.txt b/practices/level1/p03_Diophantus/3.cpp.txt new file mode 100644 index 00000000..33b53ae6 --- /dev/null +++ b/practices/level1/p03_Diophantus/3.cpp.txt @@ -0,0 +1,20 @@ +#include +int main() +{ + int fa, so = 0; + for (fa = 12;; fa += 12) + { + if (fa % 6 != 0 || fa % 7 != 0) + continue; + so = fa*17/28 - 9;// Ϊ 17/28 0so=-9 + if (so == fa/2)//ͬ1/2ǰͻᵰ + { + printf("%d\n", fa); + break; + } + + } + return 0; + +} + diff --git a/practices/level1/p03_Diophantus/p3.cpp b/practices/level1/p03_Diophantus/p3.cpp new file mode 100644 index 00000000..a9060f05 --- /dev/null +++ b/practices/level1/p03_Diophantus/p3.cpp @@ -0,0 +1,19 @@ +#include +int main() +{ + int fa, so = 0; + for (fa = 12;; fa += 12) + { + if (fa % 6 != 0 || fa % 7 != 0) + continue; + so = fa * 17 / 28 - 9; + if (so == fa / 2) + { + printf("%d\n", fa); + break; + } + + } + return 0; + +} \ No newline at end of file diff --git a/practices/level1/p04_ narcissus/4.cpp.txt b/practices/level1/p04_ narcissus/4.cpp.txt new file mode 100644 index 00000000..3c5b109f --- /dev/null +++ b/practices/level1/p04_ narcissus/4.cpp.txt @@ -0,0 +1,25 @@ + +#include +int show(int a); +int main() +{ + int i; + for (i = 100; i <= 999; i++) + if (show(i)) + printf("%d\n", i); + return 0; + +} +int show(int a) +{ + int m, n, p; + m = a % 10; + n = (a / 10) % 10; + p = (a / 100); + if (m*m*m + n*n*n + p*p*p == a) + return 1; + else + return 0; + +} + diff --git a/practices/level1/p04_ narcissus/p4.cpp b/practices/level1/p04_ narcissus/p4.cpp new file mode 100644 index 00000000..37f4a6d5 --- /dev/null +++ b/practices/level1/p04_ narcissus/p4.cpp @@ -0,0 +1,24 @@ +#include +int show(int a); +int main(){ + int i; + for (i = 100; i <= 999; i++) + { + if (show(i)) + printf("%d\n", i); + } + return 0; + +} +int show(int a){ + int m, n, p; + m = a % 10; + n = (a / 10) % 10; + p = (a / 100); + if (m*m*m + n*n*n + p*p*p == a) + return 1; + else + return 0; + +} + diff --git a/practices/level1/p05_allPrimes/5.cpp.txt b/practices/level1/p05_allPrimes/5.cpp.txt new file mode 100644 index 00000000..571dbc2b --- /dev/null +++ b/practices/level1/p05_allPrimes/5.cpp.txt @@ -0,0 +1,30 @@ +#include "stdafx.h" +#include +int show(int n); +int main() +{ + int n = 1; + while (++n <= 2000) + { + if (show(n)) + printf("%d\n", n); + + } + return 0; +} +int show(int n) +{ + int ye = 1; + for (int q = 2; q*q <= n; q++) + { + if (n%q == 0) + { + ye = 0; + break; + } + } + if (ye) + return 1; + else + return 0; +} diff --git a/practices/level1/p05_allPrimes/p5.cpp b/practices/level1/p05_allPrimes/p5.cpp new file mode 100644 index 00000000..fab1f0fe --- /dev/null +++ b/practices/level1/p05_allPrimes/p5.cpp @@ -0,0 +1,30 @@ +#include "stdafx.h" +#include +int show(int n); +int main() +{ + int n = 1; + while (++n <= 2000) + { + if (show(n)) + printf("%d\n", n); + + } + return 0; +} +int show(int n) +{ + int ye = 1; + for (int q = 2; q*q <= n; q++) + { + if (n%q == 0) + { + ye = 0; + break; + } + } + if (ye) + return 1; + else + return 0; +} diff --git a/practices/level1/p06_Goldbach/6.cpp.txt b/practices/level1/p06_Goldbach/6.cpp.txt new file mode 100644 index 00000000..8f4a167d --- /dev/null +++ b/practices/level1/p06_Goldbach/6.cpp.txt @@ -0,0 +1,57 @@ +#include +int show(int n); +int main() +{ + int pr[25];// + int delt,a1,a2,n = 1;// + int i = 1; + int yee = 0; + while (++n <= 100) + { + if (show(n)) + pr[i++] = n; + + } + //for (int s = 0; s < 25; s++) + //printf("%d ", pr[s]); + + for (int a = 4; a <= 100; a += 2) + { + yee = 0; + for (a1 = 0; a1 < 25; a1++) + { + delt = a - pr[a1]; + for (a2 = 0; a2 < 25; a2++) + if (pr[a2] == delt) + { + printf("%d+%d=%d\n", pr[a1], pr[a2], a); + yee = 1; + break; + } + if (yee) + break; + } + + + } + + + return 0; +} +int show(int n) +{ + int ye = 1; + for (int q = 2; q*q <= n; q++) + { + if (n%q == 0) + { + ye = 0; + break; + } + } + if (ye) + return 1; + else + return 0; +} + diff --git a/practices/level1/p06_Goldbach/p6.cpp b/practices/level1/p06_Goldbach/p6.cpp new file mode 100644 index 00000000..346bb166 --- /dev/null +++ b/practices/level1/p06_Goldbach/p6.cpp @@ -0,0 +1,43 @@ +#include +int show(int n); +int main(){ + int primelist[25]; + int delt, a1, a2, n = 1; + int i = 1; + int yee = 0; + while (++n <= 100){ + if (show(n)) + primelist[i++] = n; + + } + for (int a = 4; a <= 100; a += 2){ + yee = 0; + for (a1 = 0; a1 < 25; a1++){ + delt = a - primelist[a1]; + for (a2 = 0; a2 < 25; a2++) + if (primelist[a2] == delt) + { + printf("%d+%d=%d\n", primelist[a1], primelist[a2], a); + yee = 1; + break; + } + if (yee) + break; + } + } + return 0; +} +int show(int n){ + int ye = 1; + for (int q = 2; q*q <= n; q++){ + if (n%q == 0) + { + ye = 0; + break; + } + } + if (ye) + return 1; + else + return 0; +} \ No newline at end of file diff --git a/practices/level1/p07_encrypt_decrypt/7.cpp.txt b/practices/level1/p07_encrypt_decrypt/7.cpp.txt new file mode 100644 index 00000000..34413fb5 --- /dev/null +++ b/practices/level1/p07_encrypt_decrypt/7.cpp.txt @@ -0,0 +1,32 @@ +ܡ +#include +#include +int main() +{ + char ch; + while ((ch = getchar()) != EOF) + { + if (ch != 127) + putchar(ch + 1); + else + putchar('!'); + } + return 0; +} + + +ܡ +#include +#include +int main() +{ + char ch; + while ((ch = getchar()) != EOF) + { + if (ch != '!') + putchar(ch -1); + else + putchar('~'); + } + return 0; +} diff --git a/practices/level1/p07_encrypt_decrypt/p7.cpp b/practices/level1/p07_encrypt_decrypt/p7.cpp new file mode 100644 index 00000000..541e9eac --- /dev/null +++ b/practices/level1/p07_encrypt_decrypt/p7.cpp @@ -0,0 +1,32 @@ +#include"stdafx.h" +#include +#include +char s[100]; +void encrypt(char s[], int n); +void decrypt(char s[], int n); +int main() { + printf("Input the string\n"); + scanf("%s",s); + encrypt(s, strlen(s)); + printf("%s", s); + decrypt(s, strlen(s)); + printf("\n%s", s); +} +void encrypt(char s[], int n) { + int i; + for (i = 0; i < n; i++) { + if (s[i] != 127) + s[i] += 1; + else + s[i] = '!'; + } +} +void decrypt(char s[], int n) { + int i; + for (i = 0; i < n; i++) { + if (s[i] != '!') + s[i] -= 1; + else + s[i] = 127; + } +} \ No newline at end of file diff --git a/practices/level1/p08_hanoi/8.cpp.txt b/practices/level1/p08_hanoi/8.cpp.txt new file mode 100644 index 00000000..9e1219a0 --- /dev/null +++ b/practices/level1/p08_hanoi/8.cpp.txt @@ -0,0 +1,21 @@ +#include +long hh(int n); +int main() +{ + long s = 0; + s = hh(64); + printf("%lld", s); + return 0; +} +long hh(int n) +{ + long a; + if (n > 1) + a = (2 * hh(n - 1) + 1); + else + a = 1; + return a; + + +} + diff --git a/practices/level1/p08_hanoi/p8.cpp b/practices/level1/p08_hanoi/p8.cpp new file mode 100644 index 00000000..adede454 --- /dev/null +++ b/practices/level1/p08_hanoi/p8.cpp @@ -0,0 +1,18 @@ +#include +long hh(int n); +int main() { + long s = 0; + s = hh(64); + printf("%lld", s); + return 0; +} +long hh(int n) { + long a; + if (n > 1) + a = (2 * hh(n - 1) + 1); + else + a = 1; + return a; + + +} \ No newline at end of file diff --git a/practices/level1/p09_maze/in.txt b/practices/level1/p09_maze/in.txt new file mode 100644 index 00000000..768a6472 --- /dev/null +++ b/practices/level1/p09_maze/in.txt @@ -0,0 +1,5 @@ +2 1 0 0 0 +0 1 0 0 0 +1 1 1 1 0 +1 0 1 0 0 +1 0 1 1 3 \ No newline at end of file diff --git a/practices/level1/p09_maze/maze.cpp.txt b/practices/level1/p09_maze/maze.cpp.txt new file mode 100644 index 00000000..b8422a84 --- /dev/null +++ b/practices/level1/p09_maze/maze.cpp.txt @@ -0,0 +1,135 @@ +//example +/* +2 1 0 0 0 +0 1 0 0 0 +1 1 1 1 0 +1 0 1 0 0 +1 0 1 1 3 +*/ +#include "stdafx.h" +#include +#include +#define X 5//ԹС +#define Y 5 +int maze[X][Y]; +struct now//ǰ +{ + int i; + int j; +}; +void makemaze(void);//ʾԹ +int main() +{ + char ch; + struct now a; + a = { 0,0 };//now + int i, j, yes; + yes = 0; + for (i = 0; i < X; i++)//makemaze + for (j = 0; j < Y; j++) + scanf("%d", &maze[i][j]); + system("cls"); + makemaze(); + while (scanf("%c",&ch) != EOF)//begin + { + if (yes) + { + printf("success!!!\n"); + break; + } + switch (ch) + { + case 'w': + { + + if (a.i - 1 >= 0 && maze[a.i - 1][a.j]) + { + if (maze[a.i - 1][a.j] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[--a.i][j] = 2; + system("cls"); + makemaze(); + } + break; + } + case 's': + { + if (a.i + 1 < X&&maze[a.i + 1][a.j]) + { + if (maze[a.i+1][a.j] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[++a.i][a.j] = 2; + system("cls"); + makemaze(); + } + break; + } + case 'a': + { + if (a.j - 1 >= 0 && maze[a.i][a.j - 1]) + { + if (maze[a.i ][a.j+1] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[a.i][--a.j] = 2; + printf("%d", maze[a.i][a.j - 1]); + system("cls"); + makemaze(); + } + break; + } + case 'd': + { + if (a.j + 1 < Y&&maze[a.i][a.j + 1]) + { + if (maze[a.i][a.j+1] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[a.i][++a.j] = 2; + system("cls"); + makemaze(); + break; + } + } + + + } + + + } + return 0; +} +void makemaze(void) +{ + int i, j; + printf("-----------------------------------------------------\n"); + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) + { + if (maze[i][j] == 0) + printf("O"); + if (maze[i][j] == 1) + printf(" "); + if (maze[i][j] == 2) + printf("B"); + if (maze[i][j] == 3) + printf("E"); + if (j == (Y - 1)) + printf("\n"); + } + printf("-----------------------------------------------------"); +} diff --git a/practices/level1/p09_maze/p9.cpp b/practices/level1/p09_maze/p9.cpp new file mode 100644 index 00000000..200d3afc --- /dev/null +++ b/practices/level1/p09_maze/p9.cpp @@ -0,0 +1,139 @@ +//example +/* +2 1 0 0 0 +0 1 0 0 0 +1 1 1 1 0 +1 0 1 0 0 +1 0 1 1 3 +*/ +#include "stdafx.h" +#include +#include +#include +#define X 5//ԹС +#define Y 5 +int maze[X][Y]; +struct now//ǰ +{ + int i; + int j; +}; +void makemaze(void);//ʾԹ +int main() +{ + FILE *fin; + fin = fopen("in.txt", "r"); + char ch; + struct now a; + a = { 0,0 };//now + int i, j, yes; + yes = 0; + for (i = 0; i < X; i++)//makemaze + for (j = 0; j < Y; j++) + fscanf(fin,"%d", &maze[i][j]); + fclose(fin); + system("cls"); + makemaze(); + while (scanf("%c", &ch) != EOF)//begin + { + if (yes) + { + printf("success!!!\n"); + break; + } + switch (ch) + { + case 'w': + { + + if (a.i - 1 >= 0 && maze[a.i - 1][a.j]) + { + if (maze[a.i - 1][a.j] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[--a.i][j] = 2; + system("cls"); + makemaze(); + } + break; + } + case 's': + { + if (a.i + 1 < X&&maze[a.i + 1][a.j]) + { + if (maze[a.i + 1][a.j] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[++a.i][a.j] = 2; + system("cls"); + makemaze(); + } + break; + } + case 'a': + { + if (a.j - 1 >= 0 && maze[a.i][a.j - 1]) + { + if (maze[a.i][a.j + 1] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[a.i][--a.j] = 2; + printf("%d", maze[a.i][a.j - 1]); + system("cls"); + makemaze(); + } + break; + } + case 'd': + { + if (a.j + 1 < Y&&maze[a.i][a.j + 1]) + { + if (maze[a.i][a.j + 1] == 3) + { + yes = 1; + break; + } + maze[a.i][a.j] = 1; + maze[a.i][++a.j] = 2; + system("cls"); + makemaze(); + break; + } + } + + + } + + + } + return 0; +} +void makemaze(void) +{ + int i, j; + printf("-----------------------------------------------------\n"); + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) + { + if (maze[i][j] == 0) + printf("O"); + if (maze[i][j] == 1) + printf(" "); + if (maze[i][j] == 2) + printf("B"); + if (maze[i][j] == 3) + printf("E"); + if (j == (Y - 1)) + printf("\n"); + } + printf("-----------------------------------------------------"); +} diff --git a/practices/level1/p10_pushBoxes/in.txt b/practices/level1/p10_pushBoxes/in.txt new file mode 100644 index 00000000..1a4efe10 --- /dev/null +++ b/practices/level1/p10_pushBoxes/in.txt @@ -0,0 +1,16 @@ +0 0 0 0 0 0 0 0 +0 0 0 3 0 0 0 0 +0 0 0 1 0 0 0 0 +0 0 0 4 1 4 3 0 +0 3 1 4 2 0 0 0 +0 0 0 0 4 0 0 0 +0 0 0 0 3 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 1 1 1 0 0 0 +0 0 1 1 4 0 0 0 +0 0 3 1 2 1 1 0 +0 0 3 4 1 0 1 0 +0 0 0 1 1 1 1 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/practices/level1/p10_pushBoxes/p10.cpp b/practices/level1/p10_pushBoxes/p10.cpp new file mode 100644 index 00000000..b6e62078 --- /dev/null +++ b/practices/level1/p10_pushBoxes/p10.cpp @@ -0,0 +1,215 @@ +// ConsoleApplication46.cpp : ̨Ӧóڵ㡣 +#include "stdafx.h" +#include +#include +#include +#define X 8//ԹС +#define Y 8 +struct now//ǰ +{ + int i; + int j; +}; +int maze[X][Y]; +int savefinal[X][Y];//洢յꣻ +void makemaze(void);//ʾԹ +void detectfinal(void);//¼ʼյ +int detectwin(void);//жǷʤ +void setfinal(void);//Ӻ趨Ϊյ +struct now detectplayer(void);//ҳʼλ +int main() +{ + int choosedif; + FILE *fin; + fin = fopen("in.txt", "r"); + char ch; + struct now a; + int i, j; + int step = 0;//ʾܲ + scanf("%d", &choosedif); + if (choosedif == 2) + for (int count = 0; count < 8; count++) + fscanf(fin, "%*[^\n]%*c"); + for (i = 0; i < X; i++)//makemaze + for (j = 0; j < Y; j++) + fscanf(fin, "%d", &maze[i][j]); + a = detectplayer();//now + system("cls"); + makemaze(); + detectfinal(); + printf("\nfinalstep%d\n", step); + while (scanf("%c", &ch) != EOF)//begin + { + + if (detectwin()) + { + printf("success!!!\n"); + break; + } + switch (ch) + { + case 'w': + { + + if (a.i - 1 >= 0 && maze[a.i - 1][a.j]) + { + if (maze[a.i - 1][a.j] == 4 && ((maze[a.i - 2][a.j] == 1) || (maze[a.i - 2][a.j] == 3))) + { + maze[a.i][a.j] = 1; + maze[--a.i][a.j] = 2; + maze[a.i - 1][a.j] = 4; + step++; + + } + else if (!(maze[a.i - 1][a.j] == 4 && (maze[a.i - 2][a.j] == 4 || maze[a.i - 2][a.j] == 0))) + { + maze[a.i][a.j] = 1; + maze[--a.i][a.j] = 2; + step++; + } + system("cls"); + setfinal(); + makemaze(); + printf("\nfinalstep%d\n", step); + } + break; + } + case 's': + { + if (a.i + 1 < X&&maze[a.i + 1][a.j]) + { + if (maze[a.i + 1][a.j] == 4 && (maze[a.i + 2][a.j] == 1) || (maze[a.i + 2][a.j] == 3)) + { + maze[a.i][a.j] = 1; + maze[++a.i][a.j] = 2; + maze[a.i + 1][a.j] = 4; + step++; + } + else if (!(maze[a.i + 1][a.j] == 4 && ((maze[a.i + 2][a.j] == 4) || maze[a.i + 2][a.j] == 0))) + { + maze[a.i][a.j] = 1; + maze[++a.i][a.j] = 2; + step++; + } + system("cls"); + setfinal(); + makemaze(); + printf("\nfinalstep:%d\n", step); + + } + break; + } + case 'a': + { + if (a.j - 1 >= 0 && maze[a.i][a.j - 1]) + { + if (maze[a.i][a.j - 1] == 4 && (maze[a.i][a.j - 2] == 1) || (maze[a.i][a.j - 2] == 3)) + { + maze[a.i][a.j] = 1; + maze[a.i][--a.j] = 2; + maze[a.i][a.j - 1] = 4; + step++; + } + else if (!(maze[a.i][a.j - 1] == 4 && (maze[a.i][a.j - 2] == 4 || maze[a.i][a.j - 2] == 0))) + { + maze[a.i][a.j] = 1; + maze[a.i][--a.j] = 2; + step++; + } + system("cls"); + setfinal(); + makemaze(); + printf("\nfinalstep%d\n", step); + } + break; + } + case 'd': + { + if (a.j + 1 < Y&&maze[a.i][a.j + 1]) + { + if (maze[a.i][a.j + 1] == 4 && ((maze[a.i][a.j + 2] == 4) || (maze[a.i][a.j + 2] == 3))) + { + maze[a.i][a.j] = 1; + maze[a.i][++a.j] = 2; + maze[a.i][a.j + 1] = 4; + step++; + } + else if (!(maze[a.i][a.j + 1] == 4 && (maze[a.i][a.j + 2] == 4 || maze[a.i][a.j + 2] == 0))) + { + maze[a.i][a.j] = 1; + maze[a.i][++a.j] = 2; + step++; + } + system("cls"); + setfinal(); + makemaze(); + printf("\nfinalstep%d\n", step); + }break; + } + } + } + return 0; +} +void makemaze(void) +{ + int i, j; + printf("-----------------------------------------------------\n"); + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) + { + if (maze[i][j] == 0)//ϰ + printf("O"); + if (maze[i][j] == 1)//ߵ + printf(" "); + if (maze[i][j] == 2)// + printf("T"); + if (maze[i][j] == 3)//յ + printf("E"); + if (maze[i][j] == 4)// + printf("D"); + if (j == (Y - 1)) + printf("\n"); + } + printf("-----------------------------------------------------"); +} +void detectfinal(void) { + int i, j; + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) { + if (maze[i][j] == 3) + savefinal[i][j] = 1; + else + savefinal[i][j] = 0; + } +} +int detectwin(void) { + int i, j; + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) { + if (savefinal[i][j] == 1) + if (maze[i][j] != 4) + return 0; + } + return 1; +} +void setfinal(void) { + int i, j; + for (i = 0; i < X; i++) + for (j = 0; j < Y; j++) + if (savefinal[i][j] == 1) + if ((maze[i][j] == 2) || (maze[i][j] == 1)) + maze[i][j] = 3; +} +struct now detectplayer(void) { + int a, b; + struct now re; + for (a = 0; a < X; a++) + for (b = 0; b < Y; b++) { + if (maze[a][b] == 2) + { + re.i = a; + re.j = b; + return re; + } + } +} diff --git a/practices/level1/p11_linkedList/p11.cpp b/practices/level1/p11_linkedList/p11.cpp new file mode 100644 index 00000000..faaf223a --- /dev/null +++ b/practices/level1/p11_linkedList/p11.cpp @@ -0,0 +1,161 @@ +// ConsoleApplication46.cpp : ̨Ӧóڵ㡣 +#include"stdafx.h" +#include +#include +#define NULL 0 +#define LEN sizeof(list) +typedef struct list { + int num; + list *next; +}; +list *create(void); +void turn(void); +void ergodic(list *p3);// +list *turn(list *p4); +void ergodicchcek(list *p3); +int searchfive(list *p3); +int searchsecondfive(list *p3); + + + +int main() +{ + list *ps; + ps = create(); + ergodic(ps); + ps = turn(ps); + ergodic(ps); + ps = turn(ps); + printf("%d ", searchfive(ps));//ǷĽڵ + printf("%d", searchsecondfive(ps)); + return 0; +} + + + + +list *create(void)//* list +{ + int n = 0; + list *p1, *p2, *p3, *head; + p1 = p2 = p3 = head = NULL; + p1 = (list*)malloc(LEN); + scanf("%d", &p1->num); + while (p1->num != 0) { + n++; + if (n == 1) { + head = p1; + p2 = p1; + p2->next = NULL; + } + else + p2->next = p1; + p2 = p1; + p1 = (list*)malloc(LEN); + scanf("%d", &p1->num); + } + p2->next = NULL; + free(p1); + p3 = head; + return p3; +} + + + +void ergodic(list *p3) +{ + + for (;;) { + if (p3->next == NULL) { + printf("%d ", p3->num); + break; + } + else { + printf("%d ", p3->num); + p3 = p3->next; + } + } + printf("\n"); +} +list *turn(list *p4) { + list *pNextsave, *pNow, *pNext, *presult; + + int swit = 0; + pNext = pNextsave = pNow = pNext = presult = NULL; + if (p4->next == NULL) + return p4; + if (((p4->next)->next) == NULL) { + pNext = p4->next; + pNext->next = p4; + p4->next = NULL; + return pNext; + } + + pNow = p4; + pNext = p4->next; + do + { + if (swit != 1) + swit = 1; + else { + pNow = pNext;//̳ + pNext = pNextsave; + } + pNextsave = pNext->next; + pNext->next = pNow; + } while (pNextsave->next != NULL); + pNextsave->next = pNext; + p4->next = NULL; + return pNextsave; + +} + +void ergodicchcek(list *p3)//ɾ +{ + + for (;;) { + if (p3->next == NULL) { + printf("%o %o\n", p3, p3->next); + break; + } + else { + printf("%o %o\n", p3, p3->next); + p3 = p3->next; + } + } + +} + +int searchfive(list *p3) { + int n = 0; + for (;;) { + n++; + if (p3->num == 5) + return n; + else if (p3->next == NULL) + return -1; + else p3 = p3->next; + } +} + +int searchsecondfive(list *p3) { + int n = searchfive(p3); + if (n == -1) + return -1; + else { + for (int j = 1; j <= n; j++) { + if (p3->next == NULL) + return -1; + else + p3 = p3->next; + } + for (;;) { + n++; + if (p3->num == 5) + return n; + else if (p3->next == NULL) + return -1; + else p3 = p3->next; + } + } +} \ No newline at end of file diff --git a/practices/level1/p12_warehouse/12.cpp.txt b/practices/level1/p12_warehouse/12.cpp.txt new file mode 100644 index 00000000..90692304 --- /dev/null +++ b/practices/level1/p12_warehouse/12.cpp.txt @@ -0,0 +1,118 @@ + #include//ʾ + #include + typedef struct good + { + int num; + int numname; + char name[20]; + }; + good goods[1000]; + void show(void); + int findNoZero(void); + int main() + { + int i = 0; + int customscanf, yes, addorout; + int yes2;//ûҵֻ + int nozeroone;//ûдλ + int k,j = 0;//jcase3ѭ + yes2=yes = 0; + show(); + freopen("in.txt", "r", stdin); + freopen("out.txt","w",stdout); + while (scanf("%d", &i) != EOF) + { + yes = yes2 = 0; + switch (i) + { + case 1: + { + printf("name num numname\n"); + for (int j = 0; j < 1000; j++) + if (goods[j].num != 0) + printf("%s %d %d\n", goods[j].name, goods[j].num, goods[j].numname); + break; + } + case 2: + { + printf("please input the name num\n"); + scanf("%d", &customscanf); + for ( k = 0; k < 1000; k++) + { + if (goods[k].numname == customscanf) + { + printf("find it,input the number\n"); + scanf("%d", &addorout); + goods[k].num += addorout; + yes = 1; + break; + } + } + if (!yes) + { + printf("its new input the name num and the namenum\n"); + nozeroone = findNoZero();//ţ + scanf("%s%d", goods[nozeroone].name, &goods[nozeroone].num); + goods[nozeroone].numname = customscanf; + } + system("cls"); + show(); + break; + } + case 3: + { + printf("please input the name num\n"); + scanf("%d", &customscanf); + for (j = 0; j < 1000; j++) + if (goods[j].numname == customscanf) + { + yes2 = 1; + break; + } + if (yes2) + { + printf("find it,input the number\n"); + scanf("%d", &addorout); + if (addorout > goods[j].num) + { + printf("too much,you can't do this\n"); + system("cls"); + show(); + break; + } + else + goods[j].num -= addorout; + system("cls"); + show(); + break; + } + else + { + printf("no such thing !!!\n"); + break; + } + } + } + } + fclose(stdin); + fclose(stdout); + return 0; + } + void show(void) + { + for (int a = 0; a < 20; a++) + printf("-"); + printf("\n"); + printf("1.See the list\n2.Add some good\n3.Out some good\n4.q to quit\n"); + for (int a = 0; a < 20; a++) + printf("-"); + printf("\n"); + } + int findNoZero(void) + { + for (int a = 0; a < 1000; a++) + { + if (goods[a].num == 0) + return a; + } + } diff --git a/practices/level1/p12_warehouse/in.txt b/practices/level1/p12_warehouse/in.txt new file mode 100644 index 00000000..e69de29b diff --git a/practices/level1/p12_warehouse/p12.cpp b/practices/level1/p12_warehouse/p12.cpp new file mode 100644 index 00000000..38fed6a6 --- /dev/null +++ b/practices/level1/p12_warehouse/p12.cpp @@ -0,0 +1,129 @@ +// ConsoleApplication46.cpp : ̨Ӧóڵ㡣 +#include "stdafx.h" +// +#include "stdafx.h" +#include//ʾ +#include +#include +typedef struct good { + int num; + int numname; + char name[20]; +}; +good goods[1000]; +void show(void); +int findNoZero(void); +int main() { + int i = 0;//ûѡ + int customscanf, yes, addorout, total, finaltotal; + int yes2;//ûҵֻ + int nozeroone;//ûдλ + int a, k, j = 0;//jcase3ѭ + a = yes2 = yes = 0; + + FILE *fin; + fin = fopen("in.txt", "r"); + fscanf(fin, "%d", &total); + while (a < total) { + fscanf(fin, "%d %d %s", &goods[a].numname, &goods[a].num, goods[a].name); + a++; + } + fclose(fin); + show(); + while (scanf("%d",&i)!=EOF&&i!=0) { + yes = yes2 = 0; + switch (i) { + case 1: + { + printf("name num numname\n"); + for (int j = 0; j < 1000; j++) + if (goods[j].numname != 0) + printf("%-10s%-10d%-10d\n", goods[j].name, goods[j].num, goods[j].numname); + break; + } + case 2: + { + printf("please input the name num\n"); + scanf("%d", &customscanf); + for (k = 0; k < 1000; k++) { + if (goods[k].numname == customscanf) + { + printf("find it,input the number\n"); + scanf("%d", &addorout); + goods[k].num += addorout; + yes = 1; + break; + } + } + if (!yes) + { + printf("its new goods.Please input the name and its number\n"); + nozeroone = findNoZero();//ֺ + scanf("%s%d", goods[nozeroone].name, &goods[nozeroone].num); + goods[nozeroone].numname = customscanf; + } + system("cls"); + show(); + break; + } + case 3: + { + printf("please input the name num\n"); + scanf("%d", &customscanf); + for (j = 0; j < 1000; j++) + if (goods[j].numname == customscanf) + { + yes2 = 1; + break; + } + if (yes2) + { + printf("find it,input the number\n"); + scanf("%d", &addorout); + if (addorout > goods[j].num) + { + printf("too much,you can't do this\n"); + system("cls"); + show(); + break; + } + else + goods[j].num -= addorout; + system("cls"); + show(); + break; + } + else + { + printf("no such thing !!!\n"); + break; + } + } + } + } + fin=fopen("in.txt", "w"); + for (int a = 0;; a++) + if (goods[a].numname == 0) { + finaltotal = a + 1; + fprintf(fin, "%d\n", finaltotal); + break; + } + for (int a = 0; a < finaltotal - 1; a++) + fprintf(fin,"%d %d %s\n", goods[a].numname, goods[a].num, goods[a].name); + return 0; +} +void show(void) { + for (int a = 0; a < 20; a++) + printf("-"); + printf("\n"); + printf("1.See the list\n2.Add some good\n3.Out some good\n4.0 to quit\n"); + for (int a = 0; a < 20; a++) + printf("-"); + printf("\n"); +} +int findNoZero(void) { + for (int a = 0; a < 1000; a++) { + if (goods[a].numname == 0) + return a; + } +} diff --git a/practices/level1/saftearray/Safearray.cpp b/practices/level1/saftearray/Safearray.cpp new file mode 100644 index 00000000..66100d2f --- /dev/null +++ b/practices/level1/saftearray/Safearray.cpp @@ -0,0 +1,20 @@ +#include "stdafx.h" +#include "Safearray.h" +#include +using namespace std; +bool Safearray::in(void) { + return(now < 100); +} +void Safearray::output(int n) { + if (n<100) + cout << "Too muck" << endl; + else + cout << data[n]; +} +void Safearray::input(int n){ + if (!in()) + cout << "Too much" << endl; + else + data[now] = n; + now++; +} \ No newline at end of file diff --git a/practices/level1/saftearray/Safearray.h b/practices/level1/saftearray/Safearray.h new file mode 100644 index 00000000..5b00e19c --- /dev/null +++ b/practices/level1/saftearray/Safearray.h @@ -0,0 +1,12 @@ +#pragma once +class Safearray +{ +public: + bool in(void); + void input(int n); + void output(int n); +private: + int data[100]; + int now = 0; +}; + diff --git a/practices/level1/saftearray/safearray2.cpp b/practices/level1/saftearray/safearray2.cpp new file mode 100644 index 00000000..8b3c9870 --- /dev/null +++ b/practices/level1/saftearray/safearray2.cpp @@ -0,0 +1,18 @@ +// safearray2.cpp : ̨Ӧóڵ㡣 +// + +#include "stdafx.h" +#include"Safearray.h" +#include +using namespace std; +int main() +{ + int n; + Safearray a; + for (int i = 0; i < 100; i++) + a.input(i); + cin >> n; + a.output(n); + return 0; +} + diff --git a/practices/level1/stack/Stack.cpp b/practices/level1/stack/Stack.cpp new file mode 100644 index 00000000..768b3f72 --- /dev/null +++ b/practices/level1/stack/Stack.cpp @@ -0,0 +1,18 @@ +#include "stdafx.h" +#include "Stack.h" +bool Stack::isFull(void){ + return(now == 100); +} +bool Stack::isEmpty(void) { + return(now == 0); +} +void Stack::push(int n) { + if (!isFull()) { + data[now] = n; + now++; + } +} +void Stack::pop(void) { + if (!isEmpty()) + now--; +} \ No newline at end of file diff --git a/practices/level1/stack/Stack.h b/practices/level1/stack/Stack.h new file mode 100644 index 00000000..7d671506 --- /dev/null +++ b/practices/level1/stack/Stack.h @@ -0,0 +1,15 @@ +#pragma once +class Stack +{ +public: + bool isFull(void); + bool isEmpty(void); + void push(int n); + void pop(void); + +private: + int now= 0; + int data[100]; + +}; + diff --git a/practices/level1/stack/p2.cpp b/practices/level1/stack/p2.cpp new file mode 100644 index 00000000..a5ed0f0d --- /dev/null +++ b/practices/level1/stack/p2.cpp @@ -0,0 +1,16 @@ +// ConsoleApplication47.cpp : ̨Ӧóڵ㡣 +// + +#include "stdafx.h" +#include +#include"Stack.h" +using namespace std; +int main() +{ + Stack a; + for (int i = 0; i < 100; i++) + a.push(i); + a.pop(); + return 0; +} + diff --git "a/\345\256\236\351\252\214\346\212\245\345\221\212.md" "b/\345\256\236\351\252\214\346\212\245\345\221\212.md" new file mode 100644 index 00000000..a22d0cd7 --- /dev/null +++ "b/\345\256\236\351\252\214\346\212\245\345\221\212.md" @@ -0,0 +1,40 @@ +### 实验报告 + +#### 关于内容 +1.本游戏的目标人群 + +* 本游戏是单人游戏,主打的是密集子弹下玩家进行躲避,没有多人内容 + +2.游戏的基本规则 + +* 游戏全程共一关,分为boss战和道中,关卡的推进与时间相关。规则与基本打飞机规则一致,敌人有血量设定,玩家只要被子弹击中一次或是与小怪接触便减少一点生命值,初始生命值一共3点,全部失去后死亡。 +* 玩家子弹威力不会升级,但是拥有bomb,每次使用bomb会消去全屏的子弹和小怪,并且使用bomb和死亡复活时会获得4s的无敌时间 + +##### 小怪阶段 +* 小怪阶段可分为两个小阶段,第一阶段有在一定高度随机横着出现并沿直线飞过屏幕的发射三枚子弹的小怪,击杀此类小怪可以获得道具“点”,唯一的作用是增加游戏分数,第二阶段增加了竖着坠落的死尸小怪,死尸小怪只有一血,如果不攻击只有碰撞判定。若击杀则会发射5颗子弹,并且沿着y轴方向的子弹弹速较快,难以躲避。两个阶段分别持续一段固定的时间 + +##### Boss战阶段 +* boss出现时将等待10s用于使得出界的子弹消失 +* boss的第一阶段将会发射圆形的子弹,并且自身会进行倒三角形移动,避免玩家站着不动就可以躲开子弹情况 +* boss的第二阶段仍然会发射圆形子弹,但是因为发射时自身的位置在一定区域内随机出现且发射频率较高,所以会比较难以躲避。且看起来比较杂乱 +* boss的第三阶段是在比较低的位置发射大量的随机子弹(数目固定,且子弹下一过程中轨迹也是随机的,boss本身也会不停的从屏幕左边移动到屏幕的右边。 +#### 关于以上想法的实现 +##### 材料 +* 使用了sfml中的audio,graphics,system几个库 +##### 环境的配置 +* 配置环境:按照SFML官方教程配置就可以,配置过程中遇到的问题是对于同一个类型的功能(如Audio),有一些库是用来debug模式的,有一些是用来其他模式下用的,如果混用就会发生类似“无法解释的外部名称”这种报错类型。在配置的过程中花了一番功夫。 +#### 自我评价 +* 关于帧数:我采用了setframe这个函数,并且设置为了100,在实现初期因为没有清理出界的sprite和enemy和bullet,导致了内存在持续上升(从任务管理器观测),玩一段时间以后便出现了效能问题。在后期清理出界元素以后情况好转了一些,在boss战的时候后子弹虽然增长了许多,但是由于碰撞判定的简化和不再需要判定吃道具,帧数依然可以得到保证 +* 关于游戏界面和图形和音乐:由于我没有比较好的图像处理软件(抠图用的是美图秀秀...),而且改游戏的核心在于子弹的设计。所以界面非常简单。甚至取消了背景 +* 运行界面截图 +* 希望改进的部分: + 1. 更加美观的页面,由于期末和六级的原因我已经没有时间实现了 + 2. 更多的关卡,由于对const的理解不够深刻,我们没有实现我想实现的最后一个关卡。而且我本来想实现更多的关卡 + 3. 使用圆形碰撞判定,由于考虑到效率问题,我采用了sfml自带的方向判定(事实上本类游戏的特点便是判定点远远小于自身的贴图大小,否则在密集子弹下无法存活,由于时间问题我担心做好以后发现有效能问题,最后没有时间调试,所以我采用了sfml自带的碰撞判定 + +#### 收获 +* 环境的搭配:我感觉环境的搭配实在是太麻烦了,出现了很多我没想到过的错误。。。而且难以解决,要说解决方法还是直接问别人吧,我在环境的搭配上花费了不少时间。 +* 面向对象编程:在最初我做这个项目的时候用的还是c语言的思想,最初主要在main函数里写了大量内容,并且考虑使用结构体,但是看了example以后我感觉用c++写这种比较大的项目真是太好了...功能之间的关系都很明朗,不过类之间通信比较麻烦,因为我是在想不到什么方法可以把hero的position传到bullet那个类里面(如果可以这么做,可以实现指向自机的子弹)(虽然可以通过把自机的位置作为参数传递给bullet这个类,使得最初设置位置的时候可以设置成指向自机,但是这太麻烦了。我问了其他人好想是应当把这个自机的位置设置为静态变量,但是似乎在vs里面把sf类里的一些结构设置为全局变量和静态变量都会出很多问题。所以最后我放弃了 +* vs的使用:在这个项目里边真的用到了很多的类,而且每个类的成员函数非常多,我感觉到后面我发现很多vs的功能还是很实用的,像是用F12找定义位置,创建成员函数以后直接用Ctrl+.来描述这个函数。 +* 另外还积累了很多vs报错的原因,现在看到vs的有些报错大致能猜到是出了什么小问题(像少了个大括号或者是调用函数忘记加括号了 +* 在实现圆形子弹我要写很多重复的内容,于是我用到了前半个学期学的文件输入输出的方法写了小程序帮助我写一些重复度很高的内容,我感觉以后可能也要用到这个技巧。