#pragma comment(lib, "irrklang.lib") #include <windows.h> namespace SuperMetroidCraft {

Similar documents
Lampiran B. Program pengendali

Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

Lucrare pentru colocviu de practică

Operatii pop si push-stiva

User-Defined Controls

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

CSC 211 Intermediate Programming

Tutorial 5 Completing the Inventory Application Introducing Programming

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6.

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects

Managed C++ and.net Development STEPHEN R. G. FRASER

Start Visual Studio, create a new project called Helicopter Game and press OK

IBSDK Quick Start Tutorial for C# 2010

We are going to use some graphics and found a nice little batman running GIF, off course you can use any image you want for the project.

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list

Inheriting Windows Forms with Visual C#.NET

This is the start of the server code

Lucrare pentru colocviul de practica informatica an II calculatoare COTFAS VLAD CALC 2

CALCULATOR APPLICATION

Click on the empty form and apply the following options to the properties Windows.

This is the empty form we will be working with in this game. Look under the properties window and find the following and change them.

this.openfiledialog = new System.Windows.Forms.OpenFileDialog(); this.label4 = new System.Windows.Forms.Label(); this.

Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.

Ballbot. Scott Pokorny. EML 5666 Intelligent Machines Design Lab. Instructors: Dr. A. Antonio Arroyo and Dr. Eric M. Schwartz

Avoiding KeyStrokes in Windows Applications using C#

Flag Quiz Application

Now find the button component in the tool box. [if toolbox isn't present click VIEW on the top and click toolbox]

PS2 Random Walk Simulator

Form Properties Window

LISTING PROGRAM. //Find the maximum and minimum values in the array int maxvalue = integers[0]; //start with first element int minvalue = integers[0];

Start Visual Studio, start a new Windows Form project under the C# language, name the project BalloonPop MooICT and click OK.

In order to create your proxy classes, we have provided a WSDL file. This can be located at the following URL:

Visual Studio Windows Form Application #1 Basic Form Properties

Web Services in.net (2)

CSIS 1624 CLASS TEST 6

Visual C# Program: Simple Game 3

UNIT-3. Prepared by R.VINODINI 1

You can call the project anything you like I will be calling this one project slide show.

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

DEFINING AN ABL FORM AND BINDING SOURCE

Using the Quinn-Curtis.Net Software (QCChart2D and QCRTGraph) with Managed C++ (MC++)

Blank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development

Chapter 12. Tool Strips, Status Strips, and Splitters

Chapter 12 - Graphical User Interface Concepts: Part 1

CIS 3260 Sample Final Exam Part II

For this example, we will set up a small program to display a picture menu for a fast food take-away shop.

EEE-425 Programming Languages (2013) 1

BackgroundWorker Component Overview 1 Multithreading with the BackgroundWorker Component 3 Walkthrough Running an Operation in the Background 10 How

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

Start Visual Studio and create a new windows form application under C# programming language. Call this project YouTube Alarm Clock.

CHAPTER 3. Writing Windows C# Programs. Objects in C#

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

CSC 330 Object-Oriented Programming. Encapsulation

Arrays. Arrays: Declaration and Instantiation. Array: An Array of Simple Values

EEE-425 Programming Languages (2013) 1

Visual Studio.NET enables quick, drag-and-drop construction of form-based applications

Chapter 6 Dialogs. Creating a Dialog Style Form

Web Services in.net (7)

C# and.net (1) cont d

Visual Basic/C# Programming (330)

Windows Forms in Action by Erik Brown Chapter 3. Copyright 2006 Manning Publications

SMITE API Developer Guide TABLE OF CONTENTS

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

An array can hold values of any type. The entire collection shares a single name

Class Test 5. Create a simple paint program that conforms to the following requirements.

Conventions in this tutorial

XNA 4.0 RPG Tutorials. Part 11b. Game Editors

if (say==0) { k.commandtext = "Insert into kullanici(k_adi,sifre) values('" + textbox3.text + "','" + textbox4.text + "')"; k.

Capturing the Mouse. Dragging Example

string spath; string sedifile = "277_005010X228.X12"; string sseffile = "277_005010X228.SemRef.EVAL0.SEF";

Web Services in.net (6) cont d

Object oriented lab /second year / review/lecturer: yasmin maki

Design-Time Integration

// Specify SEF file to load. edischema oschema = oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

Step 1: Start a GUI Project. Start->New Project->Visual C# ->Windows Forms Application. Name: Wack-A-Gopher. Step 2: Add Content

Using VO Windows in a.net Windows Form Application

Representing Recursive Relationships Using REP++ TreeView

The Microsoft.NET Framework

// Specify SEF file to load. oschema = (edischema) oedidoc.loadschema(spath + sseffilename, SchemaTypeIDConstants. Schema_Standard_Exchange_Format);

ComponentOne. CalendarView for WinForms

namespace csharp_gen277x214 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

Polymorphism. Polymorphism. CSC 330 Object Oriented Programming. What is Polymorphism? Why polymorphism? Class-Object to Base-Class.

Experiment 5 : Creating a Windows application to interface with 7-Segment LED display

EL-USB-RT API Guide V1.0

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Quick Guide for the ServoWorks.NET API 2010/7/13

Eyes of the Dragon - XNA Part 37 Map Editor Revisited

Professional ASP.NET Web Services : Asynchronous Programming

Given the C++ declaration statement below, which of the following represents the value of exforsys? e) None of the above. 1K

Radius= 10 cm, Color= Red, Weight= 200g, X= 3m, Y= 5m, Z= 2m. Radius= 10 cm, Color= Blue, Weight= 200g, X= 3m, Y= 5m, Z= 0m

Exemplu pentru utilizarea metodelor grafice

Software Coding Specs

LISTING PROGRAM. // // TODO: Add constructor code after the InitializeComponent()

namespace Gen837X222A1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

INFORMATICS LABORATORY WORK #4

C:\homeworks\PenAttention_v13_src\PenAttention_v13_src\PenAttention4\PenAttention\PenAttention.cs 1 using System; 2 using System.Diagnostics; 3 using

II. Programming Technologies

#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll>

Transcription:

Downloaded from: justpaste.it/llnu #pragma comment(lib, "irrklang.lib") #include <windows.h> namespace SuperMetroidCraft using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Media; using namespace IrrKlang; / <summary> / Summary for Form1 / </summary> public ref class Form1 : public System::Windows::Forms::Form public: Form1(void) InitializeComponent(); TODO: Add the constructor code here protected: / <summary> / Clean up any resources being used. / </summary> ~Form1() if (components) delete components; private: System::Windows::Forms::Timer^ GunTimer; protected: protected: private: System::ComponentModel::IContainer^ components; private: System::Windows::Forms::PictureBox^ Player; private: System::Windows::Forms::Timer^ PlayerMoveTimer; private: System::Windows::Forms::PictureBox^ Ground; private: System::Windows::Forms::Timer^ MasterTimer; private: System::Windows::Forms::Label^ DirLabel; private: System::Windows::Forms::PictureBox^ Grenade; private: System::Windows::Forms::Timer^ GrenadeExplosionTimer; private: System::Windows::Forms::Label^ AmmoBox; private: System::Windows::Forms::Label^ HPLabel; private: System::Windows::Forms::Label^ ScoreLabel; private: System::Windows::Forms::Label^ ComboLabel; protected: private: / <summary> / Required designer variable. static int BulletCtr=0, UpwardMomentum=-11, GrenadeUpwardsMomentum=-15, GrenadeExpCtr=0, AnimCtr=0; static int ReloadCtr=0, Ammo=100, RndHolder, MetroidCtr=0, MetLaserCtr=0;

static int MetLaserMoveCtr=0, HP=5, Score=0, PlayerDeathCtr=0, Combo=0; static array<int>^ BulletHeight=gcnew array<int>(100); static array<int>^ ShellLateral=gcnew array<int>(100); static array<int>^ ShellMomentum=gcnew array<int>(100); static array<int>^ MetMoveCtr=gcnew array<int>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0; static array<int>^ MetMoveX=gcnew array<int>(20); static array<int>^ MetMoveY=gcnew array<int>(20); static array<int>^ MetKillCtr=gcnew array<int>(20); Random^ Rnd; static bool OnGround=true, IsJumping=false, GrenadeCook=false, GrenadeThrow=false, GrenadeOnGround=false; static bool GrenadeLeft=false, Left=false, Move=false, Reload=false, DoubleJump=false; static bool IsReloading=false, GrenadeExplode=false, IsDead=false, PlayCombo=false, BulletRoll=false; static bool HasFlushedGunshot=false, HasFlushedMetLaser=false, HasFlushedMetKill=false; static array<bool>^ BulletLeft=gcnew array<bool>(100); static array<bool>^ MetDead=gcnew array<bool>(100); char dir; static String^ path="c:\\users\\owner.ben-pc\\documents\\visual Studio 2010\\Projects\\SuperMetroidCraft\\Resources\\"; static array<system::windows::forms::picturebox^>^ Bullet=gcnew array<system::windows::forms::picturebox^>(100); static array<system::windows::forms::picturebox^>^ Shell=gcnew array<system::windows::forms::picturebox^>(100); static array<system::windows::forms::picturebox^>^ MetLaser=gcnew array<system::windows::forms::picturebox^>(100); static array<system::windows::forms::picturebox^>^ Metroid=gcnew array<system::windows::forms::picturebox^>(20); static ISoundEngine^ Main=gcnew ISoundEngine(); static ISoundEngine^ Gunshot=gcnew ISoundEngine(); static ISoundEngine^ ReloadSound=gcnew ISoundEngine(); static ISoundEngine^ MetLaserSound=gcnew ISoundEngine(); static ISoundEngine^ MetKillSound=gcnew ISoundEngine(); static ISoundEngine^ GrenadeSound=gcnew ISoundEngine(); static ISoundEngine^ DeathSound=gcnew ISoundEngine(); static ISoundEngine^ ComboSound=gcnew ISoundEngine(); static ISoundEngine^ ComboBreakerSound=gcnew ISoundEngine(); / </summary> #pragma region Windows Form Designer generated code / <summary> / Required method for Designer support - do not modify / the contents of this method with the code editor. / </summary> void InitializeComponent(void) this->components = (gcnew System::ComponentModel::Container()); System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); this->guntimer = (gcnew System::Windows::Forms::Timer(this->components)); this->player = (gcnew System::Windows::Forms::PictureBox()); this->playermovetimer = (gcnew System::Windows::Forms::Timer(this->components)); this->ground = (gcnew System::Windows::Forms::PictureBox()); this->mastertimer = (gcnew System::Windows::Forms::Timer(this->components)); this->dirlabel = (gcnew System::Windows::Forms::Label()); this->grenade = (gcnew System::Windows::Forms::PictureBox()); this->grenadeexplosiontimer = (gcnew System::Windows::Forms::Timer(this->components)); this->ammobox = (gcnew System::Windows::Forms::Label()); this->hplabel = (gcnew System::Windows::Forms::Label()); this->scorelabel = (gcnew System::Windows::Forms::Label()); this->combolabel = (gcnew System::Windows::Forms::Label()); (cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->player))->begininit(); (cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->ground))->begininit();

(cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->grenade))->begininit(); this->suspendlayout(); GunTimer this->guntimer->tick += gcnew System::EventHandler(this, &Form1::GunTimer_Tick); Player this->player->image = (cli::safe_cast<system::drawing::image^ >(resources- >GetObject(L"Player.Image"))); this->player->location = System::Drawing::Point(0, 500); this->player->name = L"Player"; this->player->size = System::Drawing::Size(24, 31); this->player->tabindex = 0; this->player->tabstop = false; PlayerMoveTimer this->playermovetimer->interval = 10; this->playermovetimer->tick += gcnew System::EventHandler(this, &Form1::PlayerMoveTimer_Tick); Ground this->ground->image = (cli::safe_cast<system::drawing::image^ >(resources- >GetObject(L"Ground.Image"))); this->ground->location = System::Drawing::Point(0, 531); this->ground->name = L"Ground"; this->ground->size = System::Drawing::Size(1233, 133); this->ground->tabindex = 1; this->ground->tabstop = false; MasterTimer this->mastertimer->enabled = true; this->mastertimer->interval = 10; this->mastertimer->tick += gcnew System::EventHandler(this, &Form1::MasterTimer_Tick); DirLabel this->dirlabel->autosize = true; this->dirlabel->location = System::Drawing::Point(13, 13); this->dirlabel->name = L"DirLabel"; this->dirlabel->size = System::Drawing::Size(26, 13); this->dirlabel->tabindex = 2; this->dirlabel->text = L"Dir="; Grenade this->grenade->backgroundimage = (cli::safe_cast<system::drawing::image^ >(resources- >GetObject(L"Grenade.BackgroundImage"))); this->grenade->image = (cli::safe_cast<system::drawing::image^ >(resources- >GetObject(L"Grenade.Image"))); this->grenade->location = System::Drawing::Point(12, 29); this->grenade->name = L"Grenade"; this->grenade->size = System::Drawing::Size(7, 10); this->grenade->tabindex = 3; this->grenade->tabstop = false; GrenadeExplosionTimer this->grenadeexplosiontimer->interval = 250; this->grenadeexplosiontimer->tick += gcnew System::EventHandler(this, &Form1::GrenadeExplosionTimer_Tick); AmmoBox

this->ammobox->autosize = true; this->ammobox->location = System::Drawing::Point(679, 9); this->ammobox->name = L"AmmoBox"; this->ammobox->size = System::Drawing::Size(83, 13); this->ammobox->tabindex = 4; this->ammobox->text = L"Ammo: 100/100"; HPLabel this->hplabel->autosize = true; this->hplabel->location = System::Drawing::Point(628, 9); this->hplabel->name = L"HPLabel"; this->hplabel->size = System::Drawing::Size(45, 13); this->hplabel->tabindex = 5; this->hplabel->text = L"HP: 5/5"; ScoreLabel this->scorelabel->autosize = true; this->scorelabel->location = System::Drawing::Point(768, 9); this->scorelabel->name = L"ScoreLabel"; this->scorelabel->size = System::Drawing::Size(47, 13); this->scorelabel->tabindex = 6; this->scorelabel->text = L"Score: 0"; ComboLabel this->combolabel->autosize = true; this->combolabel->font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 40, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<system::byte>(0))); this->combolabel->location = System::Drawing::Point(514, 210); this->combolabel->name = L"ComboLabel"; this->combolabel->size = System::Drawing::Size(0, 63); this->combolabel->tabindex = 7; Form1 this->autoscaledimensions = System::Drawing::SizeF(6, 13); this->autoscalemode = System::Windows::Forms::AutoScaleMode::Font; this->backcolor = System::Drawing::SystemColors::ButtonHighlight; this->clientsize = System::Drawing::Size(1234, 664); this->controls->add(this->combolabel); this->controls->add(this->scorelabel); this->controls->add(this->hplabel); this->controls->add(this->ammobox); this->controls->add(this->grenade); this->controls->add(this->dirlabel); this->controls->add(this->ground); this->controls->add(this->player); this->name = L"Form1"; this->text = L"Form1"; this->load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->keydown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown); this->keyup += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyUp); (cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->player))->endinit(); (cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->ground))->endinit(); (cli::safe_cast<system::componentmodel::isupportinitialize^ >(this->grenade))->endinit(); this->resumelayout(false); this->performlayout(); #pragma endregion private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) Rnd=gcnew Random(); Main->Play2D(path+"MainTrack.wav",true);

private: System::Void Form1_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) if(isdead==false) Gun if(guntimer->enabled==false&&e->keycode==keys::e) GunTimer->Enabled=true; HasFlushedGunshot=false; Reload if(isreloading==false&&e->keycode==keys::r) Reload=true; Grenade if(e->keycode==keys::g) if(grenadethrow==false&&grenadeexplosiontimer->enabled==false) this->grenade->location=system::drawing::point(this->player->location.x+10, this->player- >Location.Y+10); GrenadeCook=true; Player motion if(e->keycode==keys::right) Left=false; if(e->keycode==keys::left) Left=true; if(e->keycode==keys::up) dir='u'; IsJumping=true; if(onground==false&&doublejump==false) DoubleJump=true; UpwardMomentum+=10; if(playermovetimer->enabled==false) PlayerMoveTimer->Enabled=true; for(int i=1; i<6; i++) if(this->player->imagelocation==(path+"playerrunright"+i+".jpg")) Left=false; break; for(int i=1; i<6; i++) if(this->player->imagelocation==(path+"playerrunleft"+i+".jpg")) Left=true; break;

private: System::Void Form1_KeyUp(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) Gun if(guntimer->enabled==true&&e->keycode==keys::e) GunTimer->Enabled=false; Grenade if(e->keycode==keys::g&&isdead==false) if(grenadethrow==false&&grenadeexplosiontimer->enabled==false) this->grenade->location=system::drawing::point(this->player->location.x+10, this->player- >Location.Y+10); GrenadeUpwardsMomentum=10; GrenadeThrow=true; GrenadeCook=false; if(left==true) GrenadeLeft=true; GrenadeLeft=false; if(isdead==false) Player movement if(playermovetimer->enabled==true&&e->keycode==keys::right&&onground==true) if(left==false) Move=false; PlayerMoveTimer->Enabled=false; this->player->imagelocation=(path+"playerstandright.jpg"); if(playermovetimer->enabled==true&&e->keycode==keys::right&&onground==false) if(left==false) Move=false; this->player->imagelocation=(path+"playerstandright.jpg"); if(playermovetimer->enabled==true&&e->keycode==keys::left&&onground==true) if(left==true) Move=false; PlayerMoveTimer->Enabled=false; this->player->imagelocation=(path+"playerstandleft.jpg"); if(playermovetimer->enabled==true&&e->keycode==keys::left&&onground==false) if(left==true) Move=false; this->player->imagelocation=(path+"playerstandleft.jpg");

private: System::Void GunTimer_Tick(System::Object^ sender, System::EventArgs^ e) if(bulletctr<bullet->length&&reload==false) Gunshot->Play2D(path+"Gunshot.wav",false); HasFlushedGunshot=false; if(bulletroll==false) this->bullet[bulletctr] = gcnew System::Windows::Forms::PictureBox(); this->bullet[bulletctr]->backcolor = System::Drawing::SystemColors::Window; this->bullet[bulletctr]->name = L"Bullet"; this->bullet[bulletctr]->size = System::Drawing::Size(11,3); this->bullet[bulletctr]->tabindex = 2; this->bullet[bulletctr]->location = System::Drawing::Point(this->Player->Location.X, this->player- >Location.Y+9); this->controls->add(bullet[bulletctr]); this->shell[bulletctr] = gcnew System::Windows::Forms::PictureBox(); this->shell[bulletctr]->backcolor = System::Drawing::SystemColors::Window; this->shell[bulletctr]->name = L"Shell"; this->shell[bulletctr]->size = System::Drawing::Size(12,3); this->shell[bulletctr]->tabindex = 2; this->shell[bulletctr]->location = System::Drawing::Point(this->Player->Location.X, this->player- >Location.Y+9); this->controls->add(shell[bulletctr]); this->bullet[bulletctr]->left-=(bullet[bulletctr]->location.x)-(player->location.x); this->bullet[bulletctr]->top-=((bullet[bulletctr]->location.y)-(player->location.y))-9; this->shell[bulletctr]->left-=(shell[bulletctr]->location.x)-(player->location.x); this->shell[bulletctr]->top-=((shell[bulletctr]->location.y)-(player->location.y))-9; ShellMomentum[BulletCtr]=10; if(rnd->next()%2==0) ShellLateral[BulletCtr]=Rnd->Next()%5; ShellLateral[BulletCtr]=-Rnd->Next()%5; if(left==true) BulletLeft[BulletCtr]=true; this->bullet[bulletctr]->imagelocation = path+"bulletleft.gif"; this->shell[bulletctr]->imagelocation = path+"shellleft.jpg"; if (Left==false) BulletLeft[BulletCtr]=false; this->bullet[bulletctr]->imagelocation = path+"bulletright.gif"; this->shell[bulletctr]->imagelocation = path+"shellright.jpg"; Ammo--; this->ammobox->text="ammo: "+Ammo+"/100"; BulletCtr++; if(bulletctr==bullet->length)

BulletRoll=true; if(isreloading==false) IsReloading=true; ReloadSound->Play2D(path+"Reload.wav",false); Reload=true; private: System::Void PlayerMoveTimer_Tick(System::Object^ sender, System::EventArgs^ e) Cooking grenade if(grenadecook==true) this->grenade->location=system::drawing::point(this->player->location.x+10, this->player- >Location.Y+10); Player movement if(isdead==false) Run animation if(animctr==0) AnimCtr+=PlayerMoveTimer->Interval; if(left==false) this->player->imagelocation=(path+"playerrunright1.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft1.jpg"); if(animctr<=5*playermovetimer->interval) AnimCtr+=PlayerMoveTimer->Interval; if(left==false) this->player->imagelocation=(path+"playerrunright2.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft2.jpg"); if(animctr<=10*playermovetimer->interval) AnimCtr+=PlayerMoveTimer->Interval; if(left==false) this->player->imagelocation=(path+"playerrunright3.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft3.jpg"); if(animctr<=15*playermovetimer->interval)

AnimCtr+=PlayerMoveTimer->Interval; if(left==false) this->player->imagelocation=(path+"playerrunright4.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft4.jpg"); if(animctr<=20*playermovetimer->interval) AnimCtr+=PlayerMoveTimer->Interval; if(left==false) this->player->imagelocation=(path+"playerrunright5.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft5.jpg"); if(animctr<=25*playermovetimer->interval) AnimCtr=0; if(left==false) this->player->imagelocation=(path+"playerrunright6.jpg"); if(left==true) this->player->imagelocation=(path+"playerrunleft6.jpg"); Move player if(move==true) if(left==false&&this->player->location.x<1220) this->player->left+=5; if(left==true&&this->player->location.x>=0) this->player->left-=5; Jumping if(isjumping==true) CheckDirection(); Player->BringToFront(); if(onground==true) UpwardMomentum=15; this->player->top-=upwardmomentum; UpwardMomentum--; OnGround=false; if(onground==false&&upwardmomentum>=0) this->player->top-=upwardmomentum; UpwardMomentum--;

if(onground==false&&upwardmomentum<0) if(this->player->location.y>=this->ground->location.y-31) UpwardMomentum=0; this->player->top=this->ground->location.y-31; OnGround=true; IsJumping=false; DoubleJump=false; this->player->top-=upwardmomentum; UpwardMomentum--; private: System::Void MasterTimer_Tick(System::Object^ sender, System::EventArgs^ e) Updade labels this->dirlabel->text="bulletroll="+bulletroll; this->scorelabel->text="score: "+Score; if(combo<10) this->combolabel->text=""; Check for arrow key state if(getasynckeystate(vk_left)==0&&getasynckeystate(vk_right)==0) Move=false; Move=true; Spawn Metroid if(rnd->next()%50==49) if(metroidctr<metroid->length) MetDead[MetroidCtr]=false; this->metroid[metroidctr] = gcnew System::Windows::Forms::PictureBox(); this->metroid[metroidctr]->backcolor = System::Drawing::SystemColors::Window; this->metroid[metroidctr]->imagelocation = path+"metroid.gif"; this->metroid[metroidctr]->location = System::Drawing::Point((Rnd->Next()%250)+900, (Rnd- >Next()%250)+150); this->metroid[metroidctr]->name = L"Metroid"; this->metroid[metroidctr]->size = System::Drawing::Size(32, 29); this->metroid[metroidctr]->tabindex = 2; this->controls->add(metroid[metroidctr]); MetroidCtr++; for(int i=0; i<metroidctr; i++) if(metdead[i]==true) MetDead[i]=false; this->metroid[i]->location = System::Drawing::Point((Rnd->Next()%250)+900, (Rnd- >Next()%250)+150); this->metroid[i]->imagelocation = path+"metroid.gif";

this->metroid[i]->size = System::Drawing::Size(32, 29); break; for(int i=0; i<metroidctr; i++) if(metdead[i]==true) MetDead[i]=false; this->metroid[i]->location = System::Drawing::Point((Rnd->Next()%250)+900, (Rnd- >Next()%250)+150); this->metroid[i]->imagelocation = path+"metroid.gif"; this->metroid[i]->size = System::Drawing::Size(32, 29); break; Move Metroids and make them shoot for(int i=0; i<metroidctr; i++) if(metdead[i]==false) if(metmovectr[i]==0) MetMoveCtr[i]++; if(rnd->next()%2==0) MetMoveX[i]=Rnd->Next()%5; MetMoveY[i]=Rnd->Next()%5; MetMoveX[i]=-Rnd->Next()%5; MetMoveY[i]=-Rnd->Next()%5; if(metmovectr[i]<100) MetMoveCtr[i]++; if(this->metroid[i]->location.x>850&&this->metroid[i]->location.x<1215) this->metroid[i]->left+=metmovex[i]; if(this->metroid[i]->location.x<850) this->metroid[i]->location=system::drawing::point(1210,this->metroid[i]->location.y); this->metroid[i]->location=system::drawing::point(860,this->metroid[i]->location.y); if(this->metroid[i]->location.y>35&&this->metroid[i]->location.y<500) this->metroid[i]->top+=metmovey[i]; if(this->metroid[i]->location.y<35) this->metroid[i]->location=system::drawing::point(this->metroid[i]->location.x,480); this->metroid[i]->location=system::drawing::point(this->metroid[i]->location.x,50);

MetMoveCtr[i]=0; if(rnd->next()%100==99&&metdead[i]!=true)make Metroids shoot MetLaserSound->Play2D(path+"MetLaserSound.wav"); HasFlushedMetLaser=false; if(metlaserctr<metlaser->length) this->metlaser[metlaserctr] = gcnew System::Windows::Forms::PictureBox(); this->metlaser[metlaserctr]->backcolor = System::Drawing::SystemColors::Window; this->metlaser[metlaserctr]->imagelocation = path+"metlaser.gif"; this->metlaser[metlaserctr]->location = System::Drawing::Point(this->Metroid[i]->Location.X, this->metroid[i]->location.y); this->metlaser[metlaserctr]->name = L"Laser"; this->metlaser[metlaserctr]->size = System::Drawing::Size(13, 3); this->metlaser[metlaserctr]->tabindex = 2; this->controls->add(metlaser[metlaserctr]); MetLaserCtr++; if(metlasermovectr<metlaser->length) this->metlaser[metlasermovectr]->left-=(this->metlaser[metlasermovectr]->location.x)-(this- >Metroid[i]->Location.X); this->metlaser[metlasermovectr]->top-=(this->metlaser[metlasermovectr]->location.y)-(this- >Metroid[i]->Location.Y); this->metlaser[metlasermovectr]->imagelocation = path+"metlaser.gif"; MetLaserMoveCtr++; MetLaserMoveCtr=0; Make Metroid lasers move and check for Metroid laser collision with player for(int i=0; i<metlaserctr; i++) if(this->metlaser[i]->location.x>-15) this->metlaser[i]->left-=5; this->metlaser[i]->bringtofront(); this->metlaser[i]->imagelocation=nullptr; if(this->metlaser[i]->location.x-24<=this->player->location.x&&this->metlaser[i]- >Location.X+5>this->Player->Location.X) if(this->metlaser[i]->location.y+3>=this->player->location.y&&this->metlaser[i]->location.y<this- >Player->Location.Y+34) if(hp>0) HP--; HPLabel->Text="HP: "+HP+"/5"; this->metlaser[i]->location=system::drawing::point(1000, 1000); if(hp==0&&isdead==false) IsDead=true; Score=0; this->player->size=system::drawing::size(125,100); this->player->location=system::drawing::point(this->player->location.x,this->player- >Location.Y-100);

this->player->backcolor=color::white; this->player->imagelocation=path+"bloodsplat.gif"; DeathSound->Play2D(path+"DeathSound.wav",false); if(combo>=10) ComboBreakerSound->Play2D(path+"ComboBreaker.wav"); Combo=0; Player death code if(isdead==true) if(playerdeathctr<80) PlayerDeathCtr++; IsDead=false; this->playermovetimer->enabled=false; PlayerDeathCtr=0; HP=5; HPLabel->Text="HP: "+HP+"/5"; Player->Size=System::Drawing::Size(24,34); Player->ImageLocation=(path+"PlayerStandRight.jpg"); Player->Location=System::Drawing::Point(0,500); Jumping if(upwardmomentum>-11) PlayerMoveTimer->Enabled=true; Force stand if(move==false&&left==true&&isdead==false) this->player->imagelocation=(path+"playerstandleft.jpg"); if(move==false&&left==false&&isdead==false) this->player->imagelocation=(path+"playerstandright.jpg"); Make bullets and shells move for(int i=0; i<bulletctr; i++) if(this->bullet[i]->location.x<1250&&this->bullet[i]->location.x>-15) this->bullet[i]->bringtofront(); if(bulletleft[i]==true) this->bullet[i]->left-=15; this->bullet[i]->left+=15; this->bullet[i]->imagelocation=nullptr;

if(shell[i]->location.y<550) this->shell[i]->top-=shellmomentum[i]; this->shell[i]->left-=shelllateral[i]; ShellMomentum[i]--; Check for bullet collision with Metroid for(int a=0; a<bulletctr; a++) if(this->bullet[a]->location.x<1250&&this->bullet[a]->location.x>-15) for(int b=0; b<metroidctr; b++) if(this->bullet[a]->location.x+13>=this->metroid[b]->location.x&&this->bullet[a]- >Location.X+13<this->Metroid[b]->Location.X+32) if(this->bullet[a]->location.y+3>=this->metroid[b]->location.y&&this->bullet[a]- >Location.Y+3<this->Metroid[b]->Location.Y+29) if(metdead[b]==false) MetDead[b]=true; this->bullet[a]->location = System::Drawing::Point(1000, 1000); this->metroid[b]->size = System::Drawing::Size(50,50); this->metroid[b]->imagelocation=(path+"grenadeexplosion.gif"); MetKillSound->Play2D(path+"MetKillSound.wav"); HasFlushedMetKill=false; Score++; Combo++; PlayCombo=false; CheckCombo(); Check for grenade collision with Metroid if(grenade->location!=system::drawing::point(12, 29)) for(int b=0; b<metroidctr; b++) if(this->grenade->imagelocation==(path+"grenadesprite.png"))when not exploding. if(this->grenade->location.x+this->grenade->width>=this->metroid[b]->location.x&&this- >Grenade->Location.X+this->Grenade->Width<this->Metroid[b]->Location.X+32) if(this->grenade->location.y+this->grenade->height>=this->metroid[b]->location.y&&this- >Grenade->Location.Y+this->Grenade->Height<this->Metroid[b]->Location.Y+29) if(this->grenade->imagelocation==(path+"grenadesprite.png")) GrenadeExplode=true; GrenadeThrow=false; this->grenade->backgroundimage=nullptr; this->grenade->size=system::drawing::size(50, 50); this->grenade->imagelocation=(path+"grenadeexplosion.gif"); this->grenadeexplosiontimer->enabled=true; GrenadeSound->Play2D(path+"GrenadeSound.wav",false); for(int c=0; c<metroidctr; c++)

if(this->grenade->location.x+50>=this->metroid[c]->location.x&&this->grenade- >Location.X-50<this->Metroid[c]->Location.X+32) if(this->grenade->location.y+50>=this->metroid[c]->location.y&&this->grenade- >Location.Y-50<this->Metroid[c]->Location.Y+29) if(metdead[c]==false) MetDead[c]=true; this->metroid[c]->size = System::Drawing::Size(50,50); this->metroid[c]->imagelocation=(path+"grenadeexplosion.gif"); MetKillSound->Play2D(path+"MetKillSound.wav"); HasFlushedMetKill=false; Score++; Combo++; PlayCombo=false; CheckCombo(); if(metdead[b]==false) MetDead[b]=true; this->metroid[b]->size = System::Drawing::Size(50,50); this->metroid[b]->imagelocation=(path+"grenadeexplosion.gif"); MetKillSound->Play2D(path+"MetKillSound.wav"); HasFlushedMetKill=false; Metroid exploding code for(int i=0; i<metroidctr; i++) if(metdead[i]==true) if(metkillctr[i]<25) MetKillCtr[i]++; MetKillCtr[i]=0; this->metroid[i]->location = System::Drawing::Point(1000, 1000); Reloading if(isreloading==false&&reload==true) IsReloading=true; ReloadSound->Play2D(path+"Reload.wav",false); if(reload==true) ReloadCtr++; if(reloadctr==75) Ammo=100; this->ammobox->text="ammo: "+Ammo+"/100";

Reload=false; IsReloading=false; BulletCtr=0; ReloadCtr=0; Made grenade move if(grenadethrow==true&&grenadeexplode==false) if(grenadeupwardsmomentum>=0) if(grenadeleft==true) this->grenade->left-=15; this->grenade->left+=15; this->grenade->top-=grenadeupwardsmomentum; GrenadeUpwardsMomentum--; if(grenadeupwardsmomentum<0) if(this->grenade->location.y>=this->ground->location.y-10&&this->grenadeexplosiontimer- >Enabled==false) this->grenade->backgroundimage=nullptr; this->grenade->size=system::drawing::size(50, 50); this->grenade->location=system::drawing::point(this->grenade->location.x,this->ground- >Location.Y-50); this->grenade->imagelocation=path+"grenadeexplosion.gif"; this->grenadeexplosiontimer->enabled=true; GrenadeSound->Play2D(path+"GrenadeSound.wav",false); GrenadeThrow=false; GrenadeUpwardsMomentum=-15; for(int c=0; c<metroidctr; c++) if(this->grenade->location.x+50>=this->metroid[c]->location.x&&this->grenade- >Location.X-50<this->Metroid[c]->Location.X+32) if(this->grenade->location.y+50>=this->metroid[c]->location.y&&this->grenade- >Location.Y-50<this->Metroid[c]->Location.Y+29) if(metdead[c]==false) MetDead[c]=true; this->metroid[c]->size = System::Drawing::Size(50,50); this->metroid[c]->imagelocation=(path+"grenadeexplosion.gif"); MetKillSound->Play2D(path+"MetKillSound.wav"); HasFlushedMetKill=false; Score++; Combo++; PlayCombo=false; CheckCombo(); if(grenadeleft==true) this->grenade->left-=15;

this->grenade->left+=15; this->grenade->top-=grenadeupwardsmomentum; GrenadeUpwardsMomentum--; Flush objects from memory and rebuild them if(guntimer->enabled==true&&hasflushedgunshot==false) delete Gunshot; Gunshot=gcnew ISoundEngine(); HasFlushedGunshot=true; if(metlasersound- >IsCurrentlyPlaying(path+"MetLaserSound.wav")==false&&HasFlushedMetLaser==false) delete MetLaserSound; MetLaserSound=gcnew ISoundEngine(); HasFlushedMetLaser=true; if(metkillsound->iscurrentlyplaying(path+"metkillsound.wav")==false&&hasflushedmetkill==false) delete MetKillSound; MetKillSound=gcnew ISoundEngine(); HasFlushedMetKill=true; this->ground->bringtofront(); private: System::Void GrenadeExplosionTimer_Tick(System::Object^ sender, System::EventArgs^ e) if(grenadeexpctr<1250) GrenadeExpCtr+=250; if(grenadeexpctr==1250) this->grenade->size=system::drawing::size(7,10); this->grenade->location=system::drawing::point(12, 29); this->grenade->imagelocation=path+"grenadesprite.png"; GrenadeExpCtr=0; GrenadeExplosionTimer->Enabled=false; GrenadeExplode=false; void CheckDirection() for(int i=1; i<6; i++) if(this->player->imagelocation==(path+"playerrunright"+i+".jpg")) Left=false; break; for(int i=1; i<6; i++) if(this->player->imagelocation==(path+"playerrunleft"+i+".jpg")) Left=true; break; if(this->player->imagelocation==(path+"playerstandleft.jpg"))

Left=true; if(this->player->imagelocation==(path+"playerstandright.jpg")) Left=false; void CheckCombo() Check for combo if(combo>=10) this->combolabel->text="x"+combo; this->combolabel->text=""; if(combo==20&&playcombo==false) ComboSound->Play2D(path+"TwoCombo.wav", false); PlayCombo=true; if(combo==30&&playcombo==false) ComboSound->Play2D(path+"ThreeCombo.wav", false); PlayCombo=true; if(combo==40&&playcombo==false) ComboSound->Play2D(path+"FourCombo.wav", false); PlayCombo=true; if(combo==50&&playcombo==false) ComboSound->Play2D(path+"FiveCombo.wav", false); PlayCombo=true; if(combo==60&&playcombo==false) ComboSound->Play2D(path+"SixCombo.wav", false); PlayCombo=true; if(combo==70&&playcombo==false) ComboSound->Play2D(path+"SevenCombo.wav", false); PlayCombo=true; if(combo==80&&playcombo==false) ComboSound->Play2D(path+"EightCombo.wav", false); PlayCombo=true; if(combo==90&&playcombo==false) ComboSound->Play2D(path+"NineCombo.wav", false); PlayCombo=true; ;