C++ Programmer's Profile User Rating: -----

Reputation: 20 Tradesman
Group:
Contributors
Active Posts:
545 (0.3 per day)
Joined:
12-June 08
Profile Views:
11,524
Last Active:
User is offline May 12 2013 05:18 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Classic
Your Car:
Who Cares
Dream Kudos:
75

Latest Visitors

Icon   C++ Programmer f(unctional) => f(un)

Posts I've Made

  1. In Topic: Comparing of 2 arrays

    Posted 25 Apr 2013

    Are you trying to compare the entire arrays? By this I mean are you trying to see if the arrays have identical elements in them or are you trying to see if certain elements of each array are the same?
  2. In Topic: Calling Class Function from Another

    Posted 23 Apr 2013

    Player* player = new Player();
    


    Not only is there no delete for player so this is a memory leak, but you lose scope of the pointer after the initialize function. When trying to use the player pointer inside your RenderFrame function, player is not defined. To fix this, make the Player pointer a class member. Just as you did with window, then adapt the code inside your Initialize function to match how you did it for window. I hope you understand what I mean without me telling you exactly what to do or give you code. Let me know if I need to clarify anything.
  3. In Topic: Problem using characters in an array

    Posted 24 Oct 2012

    Please post your updated code so I can take a look.
  4. In Topic: Problem using characters in an array

    Posted 24 Oct 2012

    Remember, an array with size n has indexes from 0 to n - 1. So, your for loop shouldn't be going from 1 to 5, it should be going from 0 to 4. Also, in your for loop when you are inputting the value the user entered into the array, you don't use just the name, you must specify an index. This is where the for loop comes in, it keeps track of which index you are on, which is stored in the variable i.

    Looking at your test function, you obviously understand that arrays start at 0 and go to n - 1 and you also understand how to use the [] operator. Use this to fix your for loop in the main method.

    I realize that I am not the best at explaining things, but I hope that my post helped you :P
  5. In Topic: Problem with top down shooter looking angle

    Posted 28 Jun 2012

    I have fixed this problem, I am sorry that I didn't post back faster. The problem was that SFML sets the origin of the rectangle at the top left, so when I called setRotate(), it used those as the origin. I used the setOrigin function to the center position so that it would rotate with the pivot as the center. This fixed the problem :) Here is the updated Player's update function, because the whole thing isn't needed.

    void Player::update(float timeStep) {
    	if (m_window) {
    		sf::Vector2f velocity = sf::Vector2f(0.f, 0.f);
    		if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) 
    			velocity.y = -m_speed;
    		if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
    			velocity.y = m_speed;
    		if (sf::Keyboard::isKeyPressed(sf::Keyboard::D/>))
    			velocity.x = m_speed;
    		if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
    			velocity.x = -m_speed;
    		m_position.x += velocity.x * timeStep;
    		m_position.y += velocity.y * timeStep;
    		m_rect.setPosition(m_position);
    		sf::Vector2i mouse = sf::Mouse::getPosition(*m_window);
    		sf::Vector2f mouse_position = m_window->convertCoords(mouse);
    		sf::Vector2f angle = mouse_position - m_position;
    		m_angle = atan2(angle.y, angle.x);
    		m_angle *= 180.f / PI;
    		//cout << m_angle << endl;
    		m_rect.setRotation(m_angle);
    	}
    }
    


    Thank you for the help though :)

My Information

Member Title:
D.I.C Addict
Age:
23 years old
Birthday:
January 24, 1990
Gender:
Location:
My Computer
Interests:
Programming/Scripting/Game Development
Full Name:
Kevin Bacon
Years Programming:
6
Programming Languages:
C++, C#, Win32 API, PHP, HTML, CSS, Java, JavaScript, Batch, Blitz

Contact Information

E-mail:
Click here to e-mail me
AIM:
AIM  drag0nsrreal
MSN:
MSN  staplesarereal@hotmail.com
Website URL:
Website URL  http://www.google.com/

Comments

Page 1 of 1
  1. Photo

    ManCave Icon

    13 Jun 2012 - 14:46
    Hey hope you don't mind, I added you on MSN wondering if you're willing to help me with a C++ file that needs a tweak
  2. Photo

    inder1757 Icon

    18 Dec 2011 - 23:41
    hie...
  3. Photo

    byhiey Icon

    07 Nov 2011 - 07:30
    Friend, I need your help with something. It's something related to your topic on the day TicTacToe April 10, 2010 ( http://www.dreamincode.net/forums/topic/167328-c%23-tictactoe-console-question/ ). I'm not able to understand what the n8wxs meant about your code. Show me how it was to work perfectly? Send for elielfranca2011@hotmail.com Thank you!
  4. Photo

    Syrrus Icon

    01 Dec 2010 - 00:40
    Your about me is great!!! what type of game development do you do?
  5. Photo

    C++ Programmer Icon

    30 Jul 2010 - 11:06
    What do you need help with?
  6. Photo

    bubbles06 Icon

    29 Jul 2010 - 17:11
    hey sir can you help me?
Page 1 of 1