I have attempted to implement improved euler for movement of my character in a 2d platform game. When i press right the character moves right an but then slows down until a point when it starts moving left, if i press left then it just moves left.
//my euler calculations function called from main i set drag as - 0.008 and velocity as 2
void Movement::calculate()//!< calculate left and right
{//dont forget gravity +(euler equation to work out a (-10+0.04*v(t))
acc=sf::Vector2f(/*gra+*/dra*eulervel);//!< calculating euler for acceleration
eulervel=sf::Vector2f(prevEulerVel+acc);//!< calculating euler for the velocity
vel=sf::Vector2f(prevVel+((acc+prevAcc)/average));//!< calculating improved euler for velocity
pos=sf::Vector2f(prevPos+((vel+prevVel)/average));//!< calculating improved euler for position
}