SFML community forums

Help => General => Topic started by: otacilioricardo on July 31, 2013, 09:02:11 pm

Title: Sprite
Post by: otacilioricardo on July 31, 2013, 09:02:11 pm
Hi.

I have a Sprite and need to know where each element is, for example: I want a ladder and climb up this ladder.
How do I?
You can identify each stair step or have to create separate?
Thank you.
Title: Re: Sprite
Post by: datMoka on August 01, 2013, 12:02:17 am
Hey. No offense but it doesn't sound like you know much about programming in general if you're not sure how to get around this. Programming is all about problem solving; you look at what you need to do as a problem and then plan steps and methods on how to solve said problem.

Lets look at your problem. You want a player to be able to use a ladder system.

Firstly, look at what you want to happen when the problem is solved; you want the player to be able to move upwards but only when using the stairs.

You want to know when the player is in the ladder's boundaries by using sf::FloatRect. When and only when the two bounding boxes of the player and the ladder intersect should the player be able to move upwards. You could have it simple and just move the player by -ySpeed or snap them to the ladder to make it look a bit more polished.

Hope this helps.
Title: Re: Sprite
Post by: otacilioricardo on August 01, 2013, 11:04:03 pm
Hi datMoka.

Asked whether there is something ready in SFML. But thanks for the reply.

Title: Re: Sprite
Post by: phil652 on August 01, 2013, 11:19:04 pm
Go see this tutorial
http://www.youtube.com/watch?v=ma5QWDYsmBg&list=SPHJE4y54mpC5j_x90UkuoMZOdmmL9-_rg