collapse collapse

* Who's Online

  • Dot Guests: 125
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mager1794

Pages: [1] 2 3
1
C# / Re: Project
« on: March 19, 2014, 01:56:21 pm »
Same, anyone have any idea how utorrent knows where to download from? Because I feel like that could be useful in this project.

2
C# / Re: Project
« on: March 19, 2014, 01:26:02 am »
Feels like for collaboration I would need servers being hosted, That way you could connect with others interested in collaboration.

3
Beta Releases / Re: Random Number Generator
« on: March 15, 2014, 11:37:27 pm »
True, but isn't this the basis for most modern random number generators? I've seen quite a few random number algorithms and the most proficient is table based.  Granted its usually a much larger table.


4
Beta Releases / Random Number Generator
« on: March 15, 2014, 10:59:47 am »
I created a conceptual Random Number Generator by establishing a table filled with randomly pressed numbers reaching 8 digits. With the highest number being 59999999.

I don't exactly have the time to create a perfect random number generator so its not the most randomness.

At its highest capacity its pretty much a 1/n chance to be picked where n is the size of my number array.

Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    public static class NumberGenerator
    {
        //Type out random numbers
        //Max Number 59999999
        //Min Number 0
        static int currentPosition = 0;
        static int[] number = {0, 38491028, 59293982, 19297329, 42738293, 39927290, 59281023, 18326283, 29127492, 5999999, 50192839, 19382739,29372382,19283749 , 49282328, 32817238, 19237482, 59182839,12938292,29385919,39581828};


        public static int Next()
        {
            currentPosition++;
            if (currentPosition >= number.Length)
                currentPosition = 0;

            return number[currentPosition];
        }

        public static int Next(int min,int max)
        {
            return (Next()% (max - (min - 1))) + min;
        }

        public static void Seed()
        {
            Seed(DateTimeToInteger(DateTime.Now));
        }

        public static void Seed(int i)
        {
            currentPosition = (i % number.Length);
        }

        public static int DateTimeToInteger(DateTime time)
        {

            Console.WriteLine(number.Length.ToString());

            string s = "";

            s += time.Year.ToString();
            s += time.Day.ToString();
            s += time.Minute.ToString();


            return int.Parse(s);
        }
    }
}

5
Code Snipplets / Piglatin Converter
« on: March 14, 2014, 10:16:04 am »
Simple algorithm to parse typed in the console and to return an sentence output in the form of piglatin

Follows a standard pattern of finding the first vowel and shifting all the letters before the vowel to the end of the sentence and adding 'ay'

if the first letter is the first vowel, it just adds 'yay' to the word. if there are no common vowels. then the system will check for 'y' as a vowel.


Code: [Select]
static char[] vowels = { 'a', 'e', 'i', 'o', 'u'};
static string ConvertToPigLatin(string message)
        {
            string[] words = message.Split(' ');
            string pigLatin = "";

            foreach(string word in words)
            {

                pigLatin += ConvertWordToPigLatin(word) + " ";
            }

            return pigLatin;

        }

        static string ConvertWordToPigLatin(string word)
        {
            string pigLatin = "";
            string temp_word_b = "";
            string temp_word_e = "";
            int index = 0;
            int found_index = -1;

            foreach (char c in word.ToLower())
            {
               
                if (temp_word_b == "")
                {
                    foreach (char v in vowels)
                    {
                        if (c == v)
                        {
                            found_index = index;
                        }

                    }

                    if (found_index > -1)
                        temp_word_b += c;
                    else
                        temp_word_e += c;
                }
                else
                {
                    temp_word_b += c;
                }

                index++;

            }

            if (found_index > -1)
            {
                string ender = "ay";
                if (found_index == 0)
                    ender = "yay";

                pigLatin = (temp_word_b + temp_word_e + ender);

                return pigLatin;
            }
            else
            {
                return ConvertWordToPigLatin(word, true);
            }
        }

        static string ConvertWordToPigLatin(string word, bool useY)
        {
            if (useY)
            {
                string pigLatin = "";
                string temp_word_b = "";
                string temp_word_e = "";

                char[] vowelset = new char[vowels.Length + 1];
                int i = 0;
                foreach (char v in vowels)
                {
                    vowelset[i] = v;
                    i++;
                }

                vowelset[i] = 'y';


                foreach (char c in word.ToLower())
                {
                    bool vowel_found = false;
                    if (temp_word_b == "")
                    {
                        foreach (char v in vowelset)
                        {
                            if (c == v)
                            {
                                vowel_found = true;
                            }

                        }

                        if (vowel_found)
                            temp_word_b += c;
                        else
                            temp_word_e += c;
                    }
                    else
                    {
                        temp_word_b += c;
                    }

                }

                pigLatin = (temp_word_b + temp_word_e + "ay");

                return pigLatin;
            }
            else
            {
                return ConvertWordToPigLatin(word);
            }
        }
       

6
C# / Re: Project
« on: March 14, 2014, 05:01:28 am »
Applications, My struggle with games is the lack of any artistic skill at all. I get tired of looking at ugly games really fast :/

7
C# / Project
« on: March 13, 2014, 07:05:05 pm »
I took a break from programming for a while (not my choice) but coming back things just feel strange, like a teenager trying to get a date I feel like I cant find a place to start.  I want to work on something that is kind of large, not quick script solutions. I would like to freshen up on my Object Orientation to complete my project. So I guess my question is...

Can you guys think of any projects that I could do? Preferably something with some problem solving. And Something that's going to require some real architecture to maintain if I were to choose to do so.

Appreciate the help guys, coders block is a bitch.

8
Project Advertisment / Re: Math parsing engine
« on: March 13, 2014, 09:53:13 am »
Couldn't an effective method to complete this is to keep a list of all the calculations being done by the problem and then once your receive your decimal value begin working backwards to display the proper answer?

Simple Example.
sqrt(100 + 2/8);

2/8 = sqrt(100 + .25), division
100.25 = sqrt(100.25), addition
10.01249 = 10.01249, sqrt

now
apply the inverse of the function
and go back to sqrt(100.25)

check that there are no arithmetic functions left in your solution. and finished.  Just tossing ideas in case you wanted to pursue this challenge.

9
C++ / Re: Undeclared Indentifier
« on: April 30, 2013, 11:51:30 pm »
I am greatly appreciative of the help powerfear!

I honestly wasn't aware I was using precompiled headers wrong, but to be fair I didnt know much about them, I just knew they made inclusions alot easier on me.

10
C++ / Undeclared Indentifier
« on: April 30, 2013, 03:09:25 pm »
Im getting an Undeclared identifier when i try to reference my Object class inside of the ObjectManager class.

I cannot seem to pinpoint what im doing wrong here.

11
Challenges / Re: Jumping
« on: April 26, 2013, 07:35:05 am »
YET ANOTHER NECROPOST. Sorry once again. But to be fair, all the cool stuff hasn't been commented on in ages :(


This is a text based version of how I have always calculated jumping in games.

Static Gravity value. Fights against your velocity as you go up. Providing the illusion that you are slowing down on your way up and
speeding up on your way down. Which, if you've ever jumped before. Is exactly what happens.
Code: C++
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.        
  9.         cout << "Enter an initial velocity value: ";
  10.         int velocity;
  11.         cin >> velocity;
  12.         cout << "The value of gravity is 8 values per second.  Calculating Jump.\n\n";
  13.  
  14.         int gravity = 8/2;//Coulda put 4. But its half of gravity since gravity is a p/s value.
  15.         int height = 0;
  16.         cout << "Height: " << height << "\n";
  17.         height += velocity;
  18.         while(height > 0)
  19.         {
  20.                 cout << "Height: " << height << "\n";
  21.                 height += velocity;
  22.                 velocity -= gravity;
  23.                 Sleep(500);//half second sleep.
  24.         }
  25.  
  26.         //UPWARD FORCE OF THE GROUND RESISTS GRAVITY
  27.         height = 0;
  28.         cout << "Height: " << height << "\n";
  29.  
  30.         cout << "\n\n\n";
  31.  
  32.         system("pause");
  33.  
  34.  
  35. }
  36.  


--EDIT ADDED THE SLEEP FUNCTION FOR THE OVER TIME CONCEPT--

12
Challenges / Re: Algorithm Challenge
« on: April 26, 2013, 07:12:12 am »
Sorry for the necro, but its been a while since I have been programming. So im trying to get back into it.

I figured Id have a go at this problem, heres what I got.

Code: C
  1. #include <fstream>
  2. #include <ostream>
  3. #include <list>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main(int args[])
  9. {
  10.         //Create list
  11.         list<int> greater;
  12.         list<int> lesser;
  13.  
  14.         //Access input file
  15.         ifstream myfile("filename.txt");
  16.  
  17.         //Tokenize Document
  18.         int a;
  19.         while(myfile >> a)
  20.         {
  21.                 if(a >  50)
  22.                         greater.push_front(a);
  23.                 else
  24.                         lesser.push_front(a);
  25.         }
  26.  
  27.         ofstream Ostream;
  28.         //Iterate through the lists and write to file.
  29.         Ostream.open("greater_filename.txt");
  30.         for (list<int>::iterator it=greater.begin(); it!=greater.end(); ++it)
  31.                 Ostream << *it << "\n";
  32.         Ostream.close();
  33.  
  34.         Ostream.open("lesser_filename.txt");
  35.         for (list<int>::iterator it=lesser.begin(); it!=lesser.end(); ++it)
  36.                 Ostream << *it << "\n";
  37.         Ostream.close();
  38. }
  39.  

13
Introductions / Re: Hi, all
« on: October 26, 2011, 01:41:55 pm »
Hello, Willis

There are a large amount of different subjects and programming languages on this forum, so I hope you enjoy yourself.  Its truly a lot of fun.

14
OpenGL / Re: Irritating Linking Issues
« on: October 26, 2011, 12:24:55 pm »
Nevermind I fixed it.

For anyone that needs it the solution is:

When you have a header file linked to multiple files, the header file must include only definitions and you must include a .cpp file for the actual code.
Common.h
Code: [Select]
#ifndef _COMMON_
#define _COMMON_

#include "SDL.h"
#include "SDL_image.h"
#include <string>

struct Vector2
{
int x;
int y;
};


SDL_Surface *load_image( std::string filename ) ;

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination ) ;

#endif


Common.cpp
Code: [Select]
#include "Common.h"

SDL_Surface *load_image( std::string filename )
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;

loadedImage = IMG_Load( filename.c_str() );

if( loadedImage != NULL )
{
optimizedImage = SDL_DisplayFormat( loadedImage ); 
SDL_FreeSurface( loadedImage );
}

return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
{
//Make a temporary rectangle to hold the offsets
SDL_Rect offset;

//Give the offsets to the rectangle
offset.x = x;
offset.y = y;

//Blit the surface
SDL_BlitSurface( source, NULL, destination, &offset );
}



15
OpenGL / Irritating Linking Issues
« on: October 25, 2011, 07:31:47 pm »
I have a file with  common functions that i use through out my entire program and for some reason when I'm including it in multiple files it gets linking errors but I was pretty sure I did it right.  Any assistance please

Common.h
Code: [Select]
#ifndef _COMMON_
#define _COMMON_

#include "SDL.h"
#include "SDL_image.h"
#include <string>

struct Vector2
{
int x;
int y;
};


SDL_Surface *load_image( std::string filename )
{
SDL_Surface* loadedImage = NULL;
SDL_Surface* optimizedImage = NULL;

loadedImage = IMG_Load( filename.c_str() );

if( loadedImage != NULL )
{
optimizedImage = SDL_DisplayFormat( loadedImage ); 
SDL_FreeSurface( loadedImage );
}

return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
{
//Make a temporary rectangle to hold the offsets
SDL_Rect offset;

//Give the offsets to the rectangle
offset.x = x;
offset.y = y;

//Blit the surface
SDL_BlitSurface( source, NULL, destination, &offset );
}

#endif

Ball.cpp
Code: [Select]
#include "Ball.h"
#include "Common.h"

void Ball::Draw(SDL_Surface * screen)
{
}

void Ball::Load()
{
ball = load_image("ball.png");
}

void Ball::Unload()
{
}

void Ball::Update()
{
}

Game.cpp
Code: [Select]
#include "Game.h"
#include "Common.h"

bool gameOver = false;

Game::Game()
{
}

void Game::Draw(SDL_Surface *screen)
{
}

void Game::Update()
{

if(iKeyboard.IsKeyDown(SDLK_UP))
gameOver = true;

}

void Game::Load()
{
}

void Game::Unload()
{

}

bool Game::IsOver()
{
return gameOver;
}


void Game::Events()
{
iKeyboard.Clear();
if( SDL_PollEvent( &event ) )
{
if( event.type == SDL_KEYDOWN )
{
iKeyboard.keys[event.key.keysym.sym] = 1;
}


if( event.type == SDL_QUIT )
{
gameOver = true;
}
}
}

Any ideas what Im doing wrong?



16
Suggestions / Re: What do you want to learn about?
« on: October 19, 2010, 10:24:43 pm »
Something simple like pong.  The bare basic game.

-Edit-
I've started writing it as an eBook - I will write the tutorial, but I'd appreciate it if you could be kind of like an editor, just to make sure we offer the best quality.

17
Suggestions / Re: What do you want to learn about?
« on: October 18, 2010, 04:54:13 pm »
One of my biggest problems when starting actual game programming, is getting a first game going.  I think a tutorial to develop a small game would be great.  It will help people get that great feeling you have when you complete a project, especially a game.  I had a ton of satisfaction when I completed my first C++ game, it was called square tag and all you did was play tag with another person, on the same computer.  It was so simple, but we had so much fun playing it :) it was a great feeling.

Once someone has a first game, they'll understand more of how a game is meant to work, and have more understanding of the graphics library behind the game.  Plus, they would also understand the means of developing a small game engine (which also wouldn't be to bad of an idea for a tutorial)

18
Code Snipplets / [OpenGL] Custom Triangle Drawing (TriForce)
« on: September 05, 2010, 01:40:59 am »
Some very simple code using glBegin(GL_LINES) to draw triangles.  The position is the center of the triangle and the function does all the calculations just pick a location :P.

There are 3 functions
CreateSmallTriangle - creates a tiny triangle.
CreateLargeTriangle - creates a large triangle.
CreateTriangle - creates a triangle and allows the size to be specified.

As well a custom structure
Vector3 - used to define coordinate sets.

Code: C++
  1. struct Vector3
  2. {
  3.         GLfloat x;
  4.         GLfloat y;
  5.         GLfloat z;
  6.  
  7.         Vector3(GLfloat vx,GLfloat vy,GLfloat vz)
  8.         {
  9.                 x = vx;
  10.                 y = vy;
  11.                 z = vz;
  12.         }
  13. };
  14.  
  15. void CreateSmallTriangle(Vector3 * loc)
  16. {
  17.         glBegin(GL_LINES);
  18.  
  19.                 //First Line
  20.                 glVertex3f(loc->x,loc->y + 0.1f,loc->z);
  21.                 glVertex3f(loc->x - 0.1f,loc->y - 0.1f,loc->z);
  22.  
  23.                 //Second Line
  24.                 glVertex3f(loc->x - 0.1f,loc->y - 0.1f,loc->z);
  25.                 glVertex3f(loc->x + 0.1f,loc->y - 0.1f,loc->z);
  26.                
  27.                 //Third Line
  28.                 glVertex3f(loc->x + 0.1f,loc->y - 0.1f,loc->z);
  29.                 glVertex3f(loc->x,loc->y + 0.1f,loc->z);
  30.  
  31.         glEnd();
  32. }
  33.  
  34. void CreateTriangle(Vector3 * loc,GLfloat size)
  35. {
  36.         glBegin(GL_LINES);
  37.                 //First Line
  38.                 glVertex3f(loc->x,loc->y + size,loc->z);
  39.                 glVertex3f(loc->x - size,loc->y - size,loc->z);
  40.  
  41.                 //Second Line
  42.                 glVertex3f(loc->x - size,loc->y - size,loc->z);
  43.                 glVertex3f(loc->x + size,loc->y - size,loc->z);
  44.                
  45.                 //Third Line
  46.                 glVertex3f(loc->x + size,loc->y - size,loc->z);
  47.                 glVertex3f(loc->x,loc->y + size,loc->z);
  48.  
  49.         glEnd();
  50. }
  51.  
  52. void CreateLargeTriangle(Vector3 * loc)
  53. {
  54.         glBegin(GL_LINES);
  55.  
  56.                 //First Line
  57.                 glVertex3f(loc->x,loc->y + 0.9f,loc->z);
  58.                 glVertex3f(loc->x - 0.9f,loc->y - 0.9f,loc->z);
  59.  
  60.                 //Second Line
  61.                 glVertex3f(loc->x - 0.9f,loc->y - 0.9f,loc->z);
  62.                 glVertex3f(loc->x + 0.9f,loc->y - 0.9f,loc->z);
  63.                
  64.                 //Third Line
  65.                 glVertex3f(loc->x + 0.9f,loc->y - 0.9f,loc->z);
  66.                 glVertex3f(loc->x,loc->y + 0.9f,loc->z);
  67.  
  68.         glEnd();
  69. }
  70.  


Using the code above I created the triforce symbol from the legend of zelda
Code: C++
  1. CreateLargeTriangle(&Vector3(-1.0f,-0.8f,0.0f));
  2. CreateLargeTriangle(&Vector3(0.80f,-0.8f,0.0f));
  3. CreateLargeTriangle(&Vector3(-0.1f,1.0f,0.0f));
  4.  


[edited name=mager1794 date=1283669810][/edited]

19
I can definitelly tell Im going to like this series :P

I like this one so im looking forward to the rest.


Not sure if this is important at all but compiler throws an warning on line 349.  PAINTSTRUCT ps is never referenced.

20
Beta Releases / Morse Code Translator
« on: August 26, 2010, 05:21:22 pm »
The Code Isn't All Mine!

I found a morse code translator, that simply outputted "Hello World"

I really like the though of morse code, i mean who wouldn't.  There were a few problems with the translator in my opinion so basically what I did was a bunch of edits.  And now its a great translator for any sentence or even paragraph if you so choose.

Code: C++
  1. #include <windows.h>
  2.  
  3.  #include <string>
  4.  
  5.  #include <algorithm>
  6.  #include <iostream>
  7.  
  8.  
  9.  
  10.  typedef std::string::iterator siter;
  11.  
  12.  
  13.  
  14.  using std::string;
  15.  using namespace std;
  16.  
  17.  
  18.  
  19.  void MorseCode(string transmission);  // prototype
  20.  
  21.  void LongBeep() { Beep(700, 500); }
  22.  
  23.  void ShortBeep() { Beep(750, 100); }
  24.  
  25.  
  26.  
  27.  int main()
  28.  {
  29.                         bool cont = true;
  30.          string letters;
  31.          while(cont)
  32.          {
  33.                  cout << "Enter Your Message (/exit will exit):\n";
  34.          getline(std::cin,letters);
  35.          if(letters == "/exit")
  36.                                 cont = false;
  37.              else
  38.              {
  39.                          cout << "\nBegining Morse Code Operations\n";
  40.                          cout << "Outputting Morse code...\n";
  41.          MorseCode(letters);
  42.          cout << "Translation Complete\n\n\n";
  43.                  }
  44.                  system("pause");
  45.                          system("cls");
  46.                  
  47.                  }
  48.          
  49.          return 0;
  50.  
  51.  }
  52.  
  53. //// Not created by me - by some dude on dream in code
  54.  
  55.  void MorseCode(string transmission) {
  56.  
  57.          std::transform(transmission.begin(), transmission.end(), transmission.begin(), ::tolower);
  58.  
  59.  
  60.  
  61.          for(siter x = transmission.begin(); x != transmission.end(); x++) {
  62.  
  63.                  char ch = (*x);
  64.  
  65.                                  cout << "Outputting '";
  66.                                  cout << ch;
  67.                                  cout << "'\n";
  68.  
  69.                  switch(ch) {
  70.  
  71.                          case 'a':
  72.  
  73.                                  ShortBeep();
  74.  
  75.                                  LongBeep();
  76.  
  77.                                  break;
  78.  
  79.                        
  80.  
  81.                          case 'b':
  82.  
  83.                                  LongBeep();
  84.  
  85.                                  ShortBeep();
  86.  
  87.                                  ShortBeep();
  88.  
  89.                                  ShortBeep();
  90.  
  91.                                  break;
  92.  
  93.                        
  94.  
  95.                          case 'c':
  96.  
  97.                                  LongBeep();
  98.  
  99.                                  ShortBeep();
  100.  
  101.                                  LongBeep();
  102.  
  103.                                  ShortBeep();
  104.  
  105.                                  break;
  106.  
  107.  
  108.  
  109.                          case 'd':
  110.  
  111.                                  LongBeep();
  112.  
  113.                                  ShortBeep();
  114.  
  115.                                  ShortBeep();
  116.  
  117.                                  break;
  118.  
  119.  
  120.  
  121.                          case 'e':
  122.  
  123.                                  ShortBeep();
  124.  
  125.                                  break;
  126.  
  127.  
  128.  
  129.                          case 'f':
  130.  
  131.                                  ShortBeep();
  132.  
  133.                                  ShortBeep();
  134.  
  135.                                  LongBeep();
  136.  
  137.                                  ShortBeep();
  138.  
  139.                                  break;
  140.  
  141.                        
  142.  
  143.                          case 'g':
  144.  
  145.                                  LongBeep();
  146.  
  147.                                  LongBeep();
  148.  
  149.                                  ShortBeep();
  150.  
  151.                                  break;
  152.  
  153.  
  154.  
  155.                          case 'h':
  156.  
  157.                                  ShortBeep();
  158.  
  159.                                  ShortBeep();
  160.  
  161.                                  ShortBeep();
  162.  
  163.                                  ShortBeep();
  164.  
  165.                                  break;
  166.  
  167.  
  168.  
  169.                          case 'i':
  170.  
  171.                                  ShortBeep();
  172.  
  173.                                  ShortBeep();
  174.  
  175.                                  break;
  176.  
  177.  
  178.  
  179.                          case 'j':
  180.  
  181.                                  ShortBeep();
  182.  
  183.                                  LongBeep();
  184.  
  185.                                  LongBeep();
  186.  
  187.                                  LongBeep();
  188.  
  189.                                  break;
  190.  
  191.                        
  192.  
  193.                          case 'k':
  194.  
  195.                                  LongBeep();
  196.  
  197.                                  ShortBeep();
  198.  
  199.                                  LongBeep();
  200.  
  201.                                  break;
  202.  
  203.  
  204.  
  205.                          case 'l':
  206.  
  207.                                  ShortBeep();
  208.  
  209.                                  LongBeep();
  210.  
  211.                                  ShortBeep();
  212.  
  213.                                  ShortBeep();
  214.  
  215.                                  break;
  216.  
  217.  
  218.  
  219.                          case 'm':
  220.  
  221.                                  LongBeep();
  222.  
  223.                                  LongBeep();
  224.  
  225.                                  break;
  226.  
  227.                          case 'n':
  228.  
  229.                                  LongBeep();
  230.  
  231.                                  ShortBeep();
  232.  
  233.                                  break;
  234.  
  235.                        
  236.  
  237.                          case 'o':
  238.  
  239.                                  LongBeep();
  240.  
  241.                                  LongBeep();
  242.  
  243.                                  LongBeep();
  244.  
  245.                                  break;
  246.  
  247.  
  248.  
  249.                          case 'p':
  250.  
  251.                                  ShortBeep();
  252.  
  253.                                  LongBeep();
  254.  
  255.                                  LongBeep();
  256.  
  257.                                  ShortBeep();
  258.  
  259.                                  break;
  260.  
  261.  
  262.  
  263.                          case 'q':
  264.  
  265.                                  LongBeep();
  266.  
  267.                                  LongBeep();
  268.  
  269.                                  ShortBeep();
  270.  
  271.                                  LongBeep();
  272.  
  273.                                  break;
  274.  
  275.  
  276.  
  277.                          case 'r':
  278.  
  279.                                  ShortBeep();
  280.  
  281.                                  LongBeep();
  282.  
  283.                                  ShortBeep();
  284.  
  285.                                  break;
  286.  
  287.  
  288.  
  289.                          case 's':
  290.  
  291.                                  ShortBeep();
  292.  
  293.                                  ShortBeep();
  294.  
  295.                                  ShortBeep();
  296.  
  297.                                  break;
  298.  
  299.  
  300.  
  301.                          case 't':
  302.  
  303.                                  LongBeep();
  304.  
  305.                                  break;
  306.  
  307.  
  308.  
  309.                          case 'u':
  310.  
  311.                                  ShortBeep();
  312.  
  313.                                  ShortBeep();
  314.  
  315.                                  LongBeep();
  316.  
  317.                                  break;
  318.  
  319.  
  320.  
  321.                          case 'v':
  322.  
  323.                                  ShortBeep();
  324.  
  325.                                  ShortBeep();
  326.  
  327.                                  ShortBeep();
  328.  
  329.                                  LongBeep();
  330.  
  331.                                  break;
  332.  
  333.  
  334.  
  335.                          case 'w':
  336.  
  337.                                  ShortBeep();
  338.  
  339.                                  LongBeep();
  340.  
  341.                                  LongBeep();
  342.  
  343.                                  break;
  344.  
  345.  
  346.  
  347.                          case 'x':
  348.  
  349.                                  LongBeep();
  350.  
  351.                                  ShortBeep();
  352.  
  353.                                  ShortBeep();
  354.  
  355.                                  LongBeep();
  356.  
  357.                                  break;
  358.  
  359.                          case 'y':
  360.  
  361.                                  LongBeep();
  362.  
  363.                                  ShortBeep();
  364.  
  365.                                  LongBeep();
  366.  
  367.                                  LongBeep();
  368.  
  369.                                  break;
  370.                                  
  371.                          case ' ':
  372.                                                           Sleep(300);
  373.                                                           break;
  374.  
  375.  
  376.  
  377.                          case 'z':
  378.  
  379.                                  LongBeep();
  380.  
  381.                                  LongBeep();
  382.  
  383.                                  ShortBeep();
  384.  
  385.                                  ShortBeep();
  386.  
  387.                                  break;
  388.  
  389.                          default:
  390.  
  391.                                  break;
  392.  
  393.                  }
  394.  
  395.                  Sleep(50);
  396.  
  397.          }
  398.  
  399.       }
  400.  
  401.  

21
C++ / IrrLicht Engine - Throwing Errors While Attempting OOP
« on: July 28, 2010, 05:49:55 pm »
Theres are 8 files so here they go

main.cpp
Code: [Select]
#include "stdafx.h"
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

// Main Irrlicht Namespace
using namespace irr;

// Sub Namespaces
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

CEngine engine;
int main()
{

printf("Initalized");

engine.Init(L"Hello, World");

engine.Load();

printf("\nRunning Loop");
while(engine.device->run())
{
engine.Update();

engine.Draw();
}

engine.Unload();
}

Heres the heade files - I believe the errors are in here

stdafx.h
Code: [Select]
#include <irr/irrlicht.h>
#include <iostream>
#include "3DModel.h"
#include "Player.h"
#include "CEngine.h"

CEngine.h
Code: [Select]
///////////////////////////////
// ///
// Custom Engine     ///
//   Written By Mager    ///
//////////////////////////////
#pragma once
#include "stdafx.h"

// Main Irrlicht Namespace
using namespace irr;

// Sub Namespaces
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


class CEngine
{
private:
bool activated;
ICameraSceneNode * camera;
public:

Player Plr;
IVideoDriver * driver;
ISceneManager * smgr;
IrrlichtDevice * device;
ICameraSceneNode * GetCamera();
void Init(const wchar_t * text);
void Load();
void Draw();
void Update();
void Unload();
void AddLight(vector3df loc);
};

Player.h
Code: [Select]
#pragma once

#include "stdafx.h"

using namespace irr;

// Sub Namespaces
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

class Player : public Model3D
{
public:
void SetPosition(vector3df newpos);
void UpdateVariables(ICameraSceneNode * cam);
};

3DModel.h
Code: [Select]
#pragma once
///////////////////////////////
// ///
//    3D Model Class ///
//   Written By Mager    ///
//////////////////////////////
#include "stdafx.h"

using namespace irr;

// Sub Namespaces
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

class Model3D
{
private:
IAnimatedMesh * mesh;
IAnimatedMeshSceneNode * node;
public:
vector3df Position;
IAnimatedMeshSceneNode * GetMeshNode();
void Load(const irr::io::path &file,ISceneManager * smgr,IVideoDriver * driver);
void SetTexture(const irr::io::path &file,IVideoDriver * driver);
void Unload();
};

3DModel.cpp
Code: [Select]
#include "3Dmodel.h"

void Model3D::Load(const irr::io::path &file,ISceneManager * smgr,IVideoDriver * driver)
{
mesh = smgr->getMesh(file);
node = smgr->addAnimatedMeshSceneNode(mesh);
Position = vector3df(0,0,0);
if(node)
{
node->setPosition(Position);
}
}

void Model3D::SetTexture(const irr::io::path &file,IVideoDriver * driver)
{
if(node)
{
node->setMaterialFlag(EMF_LIGHTING,false);
node->setMaterialTexture(0,driver->getTexture(file));
}
}

IAnimatedMeshSceneNode * Model3D::GetMeshNode()
{
return node;
}

void Model3D::Unload()
{
mesh->drop();
node->drop();
}

Player.cpp
Code: [Select]
///////////////////////////////
// ///
//    Player Class ///
//   Written By Mager    ///
//////////////////////////////
#include "Player.h"

int curmoment = 0;
bool forward = true;
bool firstround = true;
bool raeshelishere = true;

void Player::UpdateVariables(ICameraSceneNode * cam)
{
vector3df velocity = vector3df(0,0,0.01f);
if(!raeshelishere)
{

if(curmoment == 1500 && firstround)
{
curmoment = 0;
forward = !forward;
firstround = false;
}
else if(curmoment == 3000)
{
curmoment = 0;
forward = !forward;
}
}
else
{
if(curmoment == 400 && firstround)
{
curmoment = 0;
forward = !forward;
firstround = false;
}
else if(curmoment == 8000)
{
curmoment = 0;
forward = !forward;
}
}

curmoment += 1;


if(forward)
Position += velocity;
else
Position -= velocity;

GetMeshNode()->setPosition(Position);
cam->setTarget(Position);
//cam->setPosition(Position - velocity);
}

void Player::SetPosition(vector3df newpos)
{
Position = newpos;
GetMeshNode()->setPosition(Position);
}

CEngine.cpp
Code: [Select]
#include "CEngine.h"

void CEngine::Draw()
{
driver->beginScene(true,true,SColor(0,0,100,200));
smgr->drawAll();
driver->endScene();
}

void CEngine::Load()
{
smgr->loadScene("models/myscene.irr");
Plr.Load("models/box.md2",smgr,driver);
Plr.SetTexture("models/textures/box_texture.tga",driver);
camera = smgr->addCameraSceneNode(0,vector3df(5,0,0));

}

void CEngine::Update()
{
Plr.UpdateVariables(GetCamera());
}

void CEngine::Unload()
{
Plr.Unload();
device->drop();
}

void CEngine::Init(const wchar_t * text)
{
IrrlichtDevice * dev = createDevice(EDT_DIRECT3D9,dimension2d<u32>(640,480),16,false,false,false/*,eventhandler*/);
dev->run();
if(!dev)
{
printf("Device Failed");
return;
}

dev->setWindowCaption(text);
driver = dev->getVideoDriver();
smgr = dev->getSceneManager();
device = dev;
}

ICameraSceneNode * CEngine::GetCamera()
{
return camera;
}




And Here Are The Errors:
Code: [Select]
------ Build started: Project: Irrlicht, Configuration: Release Win32 ------
Compiling...
Player.cpp
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C2146: syntax error : missing ';' before identifier 'Plr'
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C2146: syntax error : missing ';' before identifier 'Plr'
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(15) : error C2504: 'Model3D' : base class undefined
EventHandler.cpp
CEngine.cpp
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(15) : error C2504: 'Model3D' : base class undefined
.\CEngine.cpp(13) : error C2039: 'Load' : is not a member of 'Player'
        c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(14) : see declaration of 'Player'
.\CEngine.cpp(14) : error C2039: 'SetTexture' : is not a member of 'Player'
        c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(14) : see declaration of 'Player'
.\CEngine.cpp(26) : error C2039: 'Unload' : is not a member of 'Player'
        c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(14) : see declaration of 'Player'
3DModel.cpp
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C2146: syntax error : missing ';' before identifier 'Plr'
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\CEngine.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\kimberly the genius!\desktop\opengl\irrlicht\irrlicht\Player.h(15) : error C2504: 'Model3D' : base class undefined
Build log was saved at "file://c:\Documents and Settings\Kimberly the Genius!\Desktop\OpenGL\Irrlicht\Irrlicht\Release\BuildLog.htm"
Irrlicht - 15 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

22
Beta Releases / Richochet - Xbox 360 Game(On Computer)
« on: May 04, 2010, 09:41:34 pm »
I've been working on a game of mine called Richochet.

The point of Richochet is to use your skills to shoot out your red balls(which will richochet off of walls) and be reward 1 point for each one shot off.  And then you must dodge the balls as they continuously bounce off the walls.  You can also shoot a blue ball, which will last for 15 seconds and will destroy any red balls it touches.  The red balls will also assimilate themselves into the other red balls to make bigger(harder to dodge) and more damaging balls.  You have a speed boost ability also, and a healthbar.

Not a great UI, but its not the worst in the world.

Controls

Left Stick - Move around the screen.
Right Stick - Aim your cannon
Right Trigger - Shoot Gun
Left Trigger - Speed Boost
Left Bumper + Right Trigger - Shoot blue ball (cost 10pts) (they heal you)

Software Requirements
Xna 3.0
Xbox 360 Controller Software

Hardware Requirements
Xbox 360 Controller

Download Game

- EDIT - Fixed the links for you.


[edited name=Celestialkey date=1273027404][/edited]
[edited name=Celestialkey date=1273027445][/edited]
[edited name=Celestialkey date=1273027577][/edited]
[edited name=mager1794 date=1273027964][/edited]
[edited name=mager1794 date=1273028155][/edited]

23
XNA / Re: Xna Tutorial 1: Opening The Door
« on: May 02, 2010, 01:54:37 pm »
Not correct, the original Xbox was released before Xna 1.0 was, if i remember correctly

24
XNA / Xna Tutorial 1: Opening The Door
« on: May 02, 2010, 11:13:37 am »
Xna Tutorial 1: Opening The Door

The 'door' is what were going to open with in tutorial 1.  By the door I simply mean
the pathway into Xna Programming, needs to be recognized and understood.  You must
know the tools that your working with first and foremost.  We will be using Xna 3.0
and Visual C# Express 2008 (2003 + 2005 - will not work| I have no idea about Visual
Studio 2010).  These are all very simple programs to use, especially compared to what
you would have to do without them.

What we'll be working with is Windows Games for computers.  Which means we will not
be using Xbox 360 or The Zune. Sorry if thats what you wanted, but these can be
easily ported to Xbox 360 and The Zune, so no harm no foul.

Well to open this tutorial were gonna make what is called the "Game Over!" Program.
Its the exact same concept as "Hello, World" but its got the game programming twist.

- Lets begin by running Visual C# Express 2008

Excellent! Time For Step 2

- Click File -> New Project

- Your Project Selection Dialog Should be open now
- Click The Xna Game Studio 3.0 Tree Node
- Select Windows Game(3.0)

Next were gonna wanna draw some text onto the screen. To do so we need to add a
SpriteFont

- Right Click Your Content Node -> Add New Item
- Select SpriteFont And Name It Font

Look for this text
Code: [Select]
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

And turn it into this

Code: [Select]
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        SpriteFont Font;

Now we've defined our SpriteFont, lets load its content

- Go Down to Load Content and type this in

Code: [Select]
Font = Content.Load<SpriteFont>("Font");

There we go, now all the Font Variables have been defined.
Lets Code the game over message, so go down to your Draw function

Code: [Select]
spriteBatch.Begin();

spriteBatch.End();

Add that after

Code: [Select]
GraphicsDevice.Clear(Color.CornflowerBlue);

In between the space where you began and ended your spriteBatch, is where all of
your drawing will occur, now lets draw a string

Code: [Select]
spriteBatch.DrawString(Font, "Game Over!", new Vector2(340,300), Color.Red);

Now To See what we've made, Press F5


Congratulations, You Got A Game Over!!!! Wait....that doesn't sound right.

Tune In For More Tutorials Coming From Me

25
Project Advertisment / Re: Looking for Developers!
« on: March 21, 2010, 01:24:59 pm »
I wont join the server but I could help out a bit.

Checkout MMOwned pretty amazing WoWEmulation section look me up

Mager1794

26
Code Snipplets / Re: [SDL] Play Sound Effect
« on: March 08, 2010, 06:36:38 am »
No Me GUSTA OpenGL!!!!

27
Code Snipplets / [SDL] Play Sound Effect
« on: March 07, 2010, 07:42:03 pm »
I wrote a custom class to play  sound effects using SDL.


SoundEffect.h
Code: [Select]
#include "SDL.h"
#include "SDL_mixer.h"

class SoundEffect
{
public:
void Load(const char* file);
void Play(int loop = 1);
bool OpenAudio();//Only needs to be ran once, and must be ran before any sound effect functions will work
void DestroyChunk();//Be sure to run this before closing SDL
void CloseAudio();//Be sure to run this before closing SDL
void SetVolume(int volume);


private:
Mix_Chunk *effect;
};

SoundEffects.cpp
Code: [Select]
//Include SDL functions and datatypes
#include "SDL.h"
#include "SDL_mixer.h"
#include "SoundEffect.h"

void SoundEffect::DestroyChunk()
{
Mix_FreeChunk(effect);
}

void SoundEffect::CloseAudio()
{
Mix_CloseAudio();
}

void SoundEffect::SetVolume(int volume)
{
Mix_VolumeChunk(effect, volume);
}

bool SoundEffect::OpenAudio()
{
bool returnval = true;
if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 ) { returnval = false; }

return returnval;

}

void SoundEffect::Play(int loop)
{
Mix_PlayChannel( -1, effect, loop);
}

void SoundEffect::Load(const char* file)
{
effect = Mix_LoadWAV(file);
}

main.cpp
Code: [Select]
//Include SDL functions and datatypes
#include "SDL.h"
#include "SDL_mixer.h"
#include "SoundEffect.h"

int main( int argc, char* args[] )
{
SoundEffect fx;//my object to hold my sfx
SDL_Surface* screen = NULL;

//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

        //Open Audio
        // Do not not open this again(event for another SoundEffect) until you close the Audio
fx.OpenAudio();

SDL_WM_SetCaption("Play sound and show dude", NULL);
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

fx.Load( "high.wav" );//Load our file

for(int i = 0; i < 5;i++)
{
fx.SetVolume(i*50);//Set the volume
fx.Play();// Default Play Once
SDL_Delay(1000);
}

fx.Play(6);

//Pause
SDL_Delay( 2000 );

fx.DestroyChunk();//Destroy our SoundEffect

fx.CloseAudio();//Close the audio

//Quit SDL
SDL_Quit();
return 0;
}

28
Project Advertisment / Re: Looking for assistants
« on: March 07, 2010, 01:02:36 am »
once i get better at C++, I'd love to help :) but to be frank, C# is my area and i suck with game programming :(

29
Challenges / Re: Simple Text Based RPG [Kinda]
« on: March 06, 2010, 02:32:27 pm »
It wasn't a crash lol, i forgot to implement where it says once you hit level 10 you've beaten the game.

My bad, and thanks im glad you enjoy the game :D

30
Challenges / Simple Text Based RPG [Kinda]
« on: March 06, 2010, 02:14:20 pm »
I studyed C++ a bit and after working pretty hard i'd say lol

I created a tiny RPG like game played in a console

enjoy

Code: C++
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int Levels[10] = {0,50,150,250,500,750,1000,2000,2500,5000};
  7. int PlrHp[10] = {0,50,100,200,400,800,1000,1200,2000,2500};
  8. int CHp[10] = {0,30,50,100,125,150,150,200,250,500};
  9. int CDmg[10] = {0,5,7,10,12,17,22,27,35,50};
  10. bool b_continue = true;
  11. bool b_created = true;
  12. bool b_battle = true;
  13.  
  14. class Player            // class definition -- defines a new type, Critter
  15. {
  16. public:
  17.     string Name;
  18.     int Energy;
  19.     int Class;
  20.     int Level;
  21.     int Hp;
  22.     int Xp;
  23.     int aatkdmg;
  24.     int batkdmg;
  25.     int catkdmg;
  26.     string Attacks;
  27.     string ClassName;
  28.     void Attack(int type);
  29. };
  30.  
  31. Player user;
  32.  
  33. class Creature           // class definition -- defines a new type, Critter
  34. {
  35. public:
  36.     int Level;
  37.     int Hp;
  38.     int Xp;
  39.     int dmg;
  40.     void Create();
  41. };
  42.  
  43. void Creature::Create()
  44. {
  45.      Level = user.Level;
  46.      srand(time(0));
  47.      int nxp = ((rand() % (50 * Level)) + 20) ;
  48.      Xp = nxp;
  49.      Hp = ((rand() % CHp[Level]));
  50.      if(Hp < 15)
  51.            Hp += 20;
  52.      dmg = CDmg[Level];
  53. }
  54.  
  55. Creature creat;
  56.  
  57.  
  58.  
  59.  
  60. void Player::Attack(int type)
  61. {
  62.      cout << "\n\n";
  63.      if(type == 0)
  64.      {
  65.              int pdmg = (rand()%(aatkdmg * Level));
  66.              if(pdmg == 0)
  67.                      cout << "Your attack missed\n";
  68.              else
  69.              {
  70.              creat.Hp -= pdmg;
  71.              cout << "You attacked the creature for " << pdmg << " damage\n";
  72.              }
  73.      }
  74.      else if(type == 1)
  75.      {
  76.           int pdmg = (rand()%(batkdmg * Level));
  77.               if(pdmg == 0)
  78.               {
  79.                      cout << "Your attack missed\n";
  80.                      if(Energy >= 5)
  81.                      {
  82.                                Energy -= 5;
  83.                      }
  84.               }
  85.              else
  86.              {
  87.                  if(Energy >= 5)
  88.                  {
  89.                  creat.Hp -= pdmg;
  90.                  cout << "You attacked the creature for " << pdmg << " damage\n";
  91.              
  92.                  Energy -= 5;
  93.                  }
  94.                  else
  95.                  {
  96.                      cout << "Not enough energy, turn lost";
  97.                  }
  98.                }
  99.      }
  100.      else if(type == 2)
  101.      {
  102.           int pdmg = (rand()%(catkdmg * Level));
  103.               if(pdmg == 0)
  104.               {
  105.                      cout << "Your attack missed\n";
  106.                      if(Energy >= 10)
  107.                      {
  108.                                Energy -= 10;
  109.                      }
  110.               }
  111.              else
  112.              {
  113.                  if(Energy >= 10)
  114.                  {
  115.                  creat.Hp -= pdmg;
  116.                  cout << "You attacked the creature for " << pdmg << " damage\n";
  117.                  Energy -= 10;
  118.                  }
  119.                  else
  120.                  {
  121.                  cout << "Not enough energy, turn lost";
  122.                  }
  123.              }
  124.      }
  125.      int dmg = ((rand() % creat.dmg));
  126.      if(dmg == 0)
  127.             cout << "The creatures attack missed\n";
  128.      else
  129.      {
  130.      Hp -= dmg;
  131.      cout << "The Creature attacked you for " << dmg << " damage \n";
  132.      
  133.      }
  134.      cout << "You have " << Hp << " left and "<< Energy << " energy left\nThe creature has " << creat.Hp << " left\n\n";
  135. }
  136.  
  137.  
  138.  
  139.  
  140. int main()
  141. {
  142.     while(b_continue)
  143.     {
  144.                if(b_created)
  145.                {
  146.                             cout << "What is your name?" << endl;
  147.                             cin >> user.Name;
  148.                             cout << "Pick A Class\n\t0 - Warrior\n\t1 - Rogue\n\t2 - Mage\n";
  149.                             int cinclass;
  150.                             cin >> cinclass;
  151.                             user.Class = cinclass;
  152.                             if(cinclass == 0)
  153.                                         user.ClassName = "Warrior";
  154.                             else if(cinclass == 1)
  155.                                    user.ClassName = "Rogue";
  156.                             else if(cinclass == 2)
  157.                                  user.ClassName = "Mage";
  158.                             else
  159.                             {
  160.                                 cout << "Class out of range, Warrior assumed\n";
  161.                                 user.ClassName = "Warrior";
  162.                                 user.Class = 0;
  163.                             }
  164.                             user.Level = 1;
  165.                             user.Xp = 0;
  166.                             if(user.Class == 2)
  167.                             {
  168.                             user.Attacks = "0 - Fireball\n1 - Ice Dart\n2 - Shadow Blast\n";
  169.                             }
  170.                             else if(user.Class ==
  171.                              1)
  172.                             {
  173.                                  user.Attacks = "0 - Shank\n1 - Backstab\n2 - Rupture\n";
  174.                             }
  175.                             else
  176.                             {
  177.                                 user.Attacks = "0 - Swift Cut\n1 - Shield Bask\n2 - Power Swing\n";
  178.                             }
  179.                            
  180.                             user.Attacks = "Pick an attack\n" + user.Attacks;
  181.                             user.Hp = 50;
  182.                             user.aatkdmg = 3;
  183.                             user.batkdmg = 5;
  184.                             user.catkdmg = 10;
  185.                             user.Energy = 75;
  186.                              b_created = false;    
  187.                              system("cls");          
  188.                }
  189.                
  190.                cout << "Welcome " << user.Name << ", Your adventure begins here.  It is your duty as a young " << user.ClassName << " to shone your skills and become one of the best of the best.  By simply walking \naround, you must face predators to gain immense strength, if you accept this \ntask.....continue\n\n";
  191.                system("pause");
  192.                system("cls");
  193.                cout << "Let the battle begin!!\n";
  194.                
  195.                creat.Create();
  196.                
  197.                while(b_battle)
  198.                {
  199.                 if(user.Hp <= 0)
  200.                 {
  201.                            cout << "You have lost the battle, your adventure is over";
  202.                            b_continue = false;
  203.                            b_created =false;
  204.                            b_battle = false;
  205.                            
  206.                 }
  207.                 else if(creat.Hp <= 0)
  208.                 {
  209.                      cout << "You have emerged victorius\n";
  210.                      cout << "Experience Gained: " << creat.Xp << "\n";
  211.                      user.Xp += creat.Xp;
  212.                      if(user.Xp >= Levels[user.Level])
  213.                      {
  214.                                 user.Level += 1;
  215.                                 cout << "You have gained a level and are now level " << user.Level << endl;
  216.                      }
  217.                      user.Hp = PlrHp[user.Level];
  218.                      user.Energy = 75;
  219.                      cout << "\n\n\n";
  220.                      system("pause");
  221.                      system("cls");
  222.                      creat.Create();
  223.                 }
  224.                 else
  225.                 {
  226.                 cout << user.Attacks;
  227.                 int attack = 4;
  228.                 while(attack >= 3)
  229.                 {
  230.                  cin >> attack;
  231.                  if(attack < 3)
  232.                            user.Attack(attack);
  233.                 }
  234.                
  235.                
  236.                 }
  237.                }
  238.                
  239.                
  240.                
  241.     }
  242.     return 0;
  243. }
  244.  
  245.  
  246.  

Pages: [1] 2 3

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]