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.


Messages - kingsman142

Pages: [1]
1
General / Re: Can't seem to load an image from file (VS 2010)
« on: June 19, 2012, 10:17:27 pm »
Maybe dude.jpg is too large of a file.  Try loading a file that's smaller in size, or perhaps a png. 

And, make sure "dude" is actually a jpg.

2
General / Re: Can't seem to load an image from file (VS 2010)
« on: June 19, 2012, 09:25:53 pm »
The image has to be in your project folder.  Or, you can write the C: directory to the image like so:

Texture texture;
texture.loadFromFile("C:/Directory/To/Your/Image/image.jpg");
 

3
Graphics / How do I get sf::Event::KeyPressed to work?
« on: January 13, 2012, 04:07:23 am »
Code: [Select]
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Keyboard::P)){
                cout<<"The P key was pressed temporarily."<<endl;
            }


That's what I've been trying to tweak to see if KeyPressed actually works, but I haven't had any luck yet.

The only thing I've been using at the moment is when one key has been continually pushed down instead of one key just being pushed and released.

Does it need to be in a pollevent loop?  Can anybody please tell me the correct way to use the KeyPressed event?

4
Graphics / Can I make an object move smoothly without stuttering?
« on: January 12, 2012, 01:01:36 am »
Thanks, it worked.

5
Graphics / Can I make an object move smoothly without stuttering?
« on: January 11, 2012, 10:59:37 pm »
Is there a way that I can make an object move, say a ball, in one direction without using a variable to move it each frame?  

As of now, I have a sprite with a variable that equals 2.6 and that's how far it's x value increases each frame.  But if I have it as 2.6, the ball moves very slowly across the screen but it's pretty smooth.  If I increased that to like 50, it'd move fast across the screen but there's be large margins that it'd skip.

So back to my question.  Can I move, for example the ball, fast across the screen but make it move smoothly?

6
Graphics / Why does this not work properly?
« on: January 10, 2012, 11:54:09 pm »
I fixed it.  Thank you everybody, especially Caracal, for giving me useful advice that I can use in the future.

7
Graphics / Why does this not work properly?
« on: January 10, 2012, 09:41:42 pm »
Do you have any solution I could try to fix the problem, Caracal?

8
Graphics / Why does this not work properly?
« on: January 10, 2012, 12:59:47 pm »
I'm sorry Nexus and Tau Sudan.  Caracal is right.  I was irritated with this problem so much and I couldn't find a response and I became impacient so I took it out on these forums.  I apologize for the anger.  I will look into that tread the next time I'm going to post something new Nexus.  And Caracal, I'll remember to keep those things in mind and try to fix the problem.  I enjoyed reading your post.

9
Graphics / Why does this not work properly?
« on: January 10, 2012, 02:21:52 am »
Code: [Select]
if(sf::Mouse::IsButtonPressed(sf::Mouse::Left)){
                if( (bulletPos.x < cubezPos.x) && (sf::Mouse::IsButtonPressed(sf::Mouse::Left) ) ){
                    //Bullet.SetPosition(bulletPos.x + bulletSpeed , bulletPos.y);
                    //Cubez.SetPosition(cubezPos.x - cubezSpeed , cubezPos.y);
                    Sleep(1000);
                    Bullet.SetPosition(338.5, 305);
                    Cubez.SetPosition(500, 295);
                    Window.Draw(Bullet);
                    Window.Draw(Cubez);
                    Sleep(1000);
                    Bullet.SetPosition(491 , 305);
                    Cubez.SetPosition(330 , 295);
                    Window.Draw(Bullet);
                    Window.Draw(Cubez);
                }
                if((bulletPos.x > cubezPos.x) && (sf::Mouse::IsButtonPressed(sf::Mouse::Left))){
                    Cubez.SetPosition(0 , 295);
                    Sleep(3000);
                }
            }


When I hold down the left mouse button it's suppose to wait a second, move both sprites to their respectful positions then wait another second and move them again and then finish, but when I hold down the left mouse button it just waits like 2 seconds and moves each sprite to the second pair of coordinates.

Why does it not work???

10
General / How would I go about making sprites move?
« on: January 10, 2012, 01:30:40 am »
How would I make a sprite move from one location to another smoothly as in a pong ball from side to side?

Pages: [1]