1
Graphics / Re: View wont move.
« on: July 11, 2013, 01:02:36 pm »
I read the tutorial, but I missed that somehow.
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.
void Camera::Update(App& app)
{
if (currentEntity != nullptr)
{
float deltaX = currentEntity->getX()+8-getCenter().x;
float deltaY = currentEntity->getY()+8-getCenter().y;
float speedFactor = atan(app.getFrameTime()*speed)*2/3.14159265358979323846264338327950288419;
std::cout << speedFactor << " ;( ;( ;( :(\n";
setCenter(getCenter().x + deltaX*speedFactor, getCenter().y + deltaY*speedFactor);
}
}
There are at least 2 flaws in TextureContainer.cpp. (btw, who are you lol?)oh, ty... I actually know that.
The tutorial says this: "a sprite only points to an external image it doesn't own one".
Which means that:
- when your image is deleted (end of scope where you declared it) your sprite doesn't have an image anymore, hence the white box
- if your image is modified, it affects every sprites pointing to this image
Keep your image alive.TY. -.-
It's asked A LOT in the forums...
tempImage.Copy(image, 16, 0, sf::IntRect(x*spriteWidth, y*spriteHeight, (x + 1)*spriteWidth, (y + 1)*spriteHeight), true);