Welcome, Guest. Please login or register. Did you miss your activation email?

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.


Topics - LucasShadow

Pages: 1 [2]
16
Network / Quick question about the SFML Netowrking tutorials
« on: January 11, 2012, 04:53:22 am »
I am attempting to make my game a multiplayer game but know diddly-sqwat about network programming.  Are the tutorials provided on this site in-depth enough for me to adequately learn and apply the skills necessary to do what I want? Or should I buy a C++ Network Programming book.

17
Graphics / Sprite Movement on Single MouseClick
« on: January 02, 2012, 12:55:32 am »
Hello.  I was wondering if anyone had any suggestions as how to go about making a sprite move from Point A to Point B on a 2d plane.  I am able to do this, but the sprite simply warps from one point to another...I have looked into making a speed variable (dont want to use framerates because of the "faster on faster computer" thing) somehow.  I have also looked into vectors some, but have not been able to figure out how to set the sprite's position with the vector.

EDIT: Using SFML 1.6

Maybe some code will help too
Code: [Select]
if (App.GetInput().IsMouseButtonDown(sf::Mouse::Left)) {

            OldX = PlayerObj.GetPosition().x;
            OldY = PlayerObj.GetPosition().y;
            NewX = App.GetInput().GetMouseX();
            NewY = App.GetInput().GetMouseY();
            XVector = (OldX - NewX);
            YVector = (OldY - OldY);
        }
        //Vector...
        float OldPosition = ???;
        float NewPosition = ???;
        sf::Vector2f GetDir(sf::Vector2f OldPosition);
        sf::Vector2f RVector = NewPosition - OldPosition;
        float temp =(float) sqrt((RVector.x * RVector.x + RVector.y * RVector.y));
        RVector = RVector / temp;
        RVector = RVector * SPEED;
        //Set position...
        PlayerObj.SetPosition(RVector.x, RVector.y);

18
General / Storing and recalling variables within an event
« on: December 30, 2011, 04:59:16 am »
So I am trying to make an application that requires multiple values to be considered.  When EventA happens, I want Variable1 to be a certain X number.  Then, if statements can check to see if X is the number for that certain if statement, and carry on with a specific order.  I am not aware of how to do this exactly, so I tried to do it with strings:

Code: [Select]

#include <SFML/Graphics.hpp>

 int main()
 {
     // Create the main window
     sf::RenderWindow App(sf::VideoMode(800, 600), "Test");

     sf::String Value1("1");

     sf::String Text1("Value1 is active");
     Text1.SetPosition(100.f, 100.f);

     // Start the game loop
     while (App.IsOpened())
     {
         // Process events
         sf::Event Event;
         while (App.GetEvent(Event))
         {
             // Close window : exit
             if (Event.Type == sf::Event::Closed)
                 App.Close();

             if (App.GetInput().IsKeyDown(sf::Key::Up))   Value1.SetText("2")

             if (Value1.GetText() == "1")   Text1.SetText("Value1 is active");
             if (Value1.GetText() == "2")   Text1.SetText("Value1 is inactive");
         }

         // Clear screen
         App.Clear();

         // Draw the string
         App.Draw(Text1);

         // Update the window
         App.Display();
     }

     return EXIT_SUCCESS;
 }


It doesnt work though.  Any suggestions? Sorry if I havent been clear, I am not sure how to express what I want to do  :cry:

19
Graphics / Displaying a status
« on: December 29, 2011, 05:47:17 am »
So I have been messing around with trying to get the status of the music status to display as text.  I have no trouble displaying text, or getting the status, its getting the status to display as text on my screen thats the problem.  Any help would be much appreciated :)

-Lucas Shadow

Pages: 1 [2]