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 - Lardos

Pages: [1]
1
General / Re: Tutorial for vectors?
« on: April 25, 2012, 09:31:13 pm »
Thank you for the fast answers!

I did never work with sfml before and I was suprised about the Vector funktion (firstly I thought that there ist something like getPositionX() and getPositionY().

But with your examples I have unterstand, how I have to use this Vectors.
Thank you a lot!

Lardos

2
General / Tutorial for vectors?
« on: April 25, 2012, 09:02:14 pm »
Hello everyone,
Fristly sorry for my english (I'm from germany).
I have big problems with the Vector2 class in sfml 2.0. I don't know how to use it and I can't find any tutorial about this topic. For example:

I got a simple sprite and I want to make this sprite moving around (with my arrow keys). So I need the current x and y position + a value (e.g. 10), when I hit one of the arrow keys.

I found this in the documentation:

const Vector2f& sf::Transformable::getPosition   ()    const

How do I have to use it?

maybe like that?

Sprite.getPosition(sf::Vector2f(0, 0));

But this will not work because when I do this, I set the Position to 0, 0...

So, how can I get the current x and as next the current y position?

Many greetings from germany,
Lardos

Pages: [1]