I am trying to make an istance of this
Vector2f(20,20)
How to I go about this?
Jump to PostYou could post more than one line of code, so we can see the context of the question.
You could post more than one line of code, so we can see the context of the question.
Yes sorry I have defined an animated sprite in my header file like this
AnimatedSprite( const Image& Img, const Vector2f& Position = Vector2f(0, 0), const Vector2f& Scale = Vector2f(1, 1), float Rotation = 0.f, const Color& Col = Color(255, 255, 255, 255),int xCount=2,int yCount=2);
I want the user to move the sprite upwards when the up key is pressed and I have this code below.
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Up))
{
}
However because vector2f is a type I cannot manipulate it so I need to make an instance of it. How would I do this?
>> However because vector2f is a type I cannot manipulate it so I need to make an instance of it.
what do you mean?
I cannot just change the vector directly like this for example
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Up))
{
vector2f += 1;
}
This won sork so I need to make an instance of vector2f but I cannot figure it out in c++
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.