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

Author Topic: Compare the Y coordinate in a loop  (Read 1454 times)

0 Members and 1 Guest are viewing this topic.

Gauzr

  • Newbie
  • *
  • Posts: 20
    • View Profile
Compare the Y coordinate in a loop
« on: June 05, 2015, 11:11:27 pm »
Hi, I'm a bit uncertain on how I can get the value of a shape's Y coordinate. I tried doing
float shapeycord = shape1.getPosition.y();
if (shapeycoord == -100)
...
However I know this is not right. Does it have to be pointer to FloatRect? Im a bit confused. What I would like to do is get the .y coord of the shape, and if it contains a certain y coordinate, then it will do something.

Gauzr

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Compare the Y coordinate in a loop
« Reply #1 on: June 05, 2015, 11:35:19 pm »
Ah, I believe I fixed it by changing it to shape.getPosition().y, that is I think.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Compare the Y coordinate in a loop
« Reply #2 on: June 05, 2015, 11:55:50 pm »
shape.getPosition().y
looks much better  :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything