SFML community forums

Help => Graphics => Topic started by: oOhttpOo on May 12, 2015, 09:04:31 pm

Title: Set position depending on another entity
Post by: oOhttpOo on May 12, 2015, 09:04:31 pm
Hi

I want to set the position of a shape to the same (or roughly the same, doesn't really matter) position of another shape. However I cant just do .setPosition(points) as the shape is often moving, therefore I would like to set it to same position as the other shape (every time it is triggered). I tried to set the position to the other shape's global bounds. I attempted "shape1.setPosition(shape2gbs)". How can I do this?  ;)
Title: Re: Set position depending on another entity
Post by: shadowmouse on May 12, 2015, 09:13:38 pm
Have you tried using shape1.setPosition(shape2.getPosition()) at the start and whenever shape2 moves?
Title: Re: Set position depending on another entity
Post by: zsbzsb on May 12, 2015, 09:14:47 pm
There is no way to automatically move one shape when another moves, so you must do as shadowmouse said and move shape1 whenever shape2 moves.