Hello,
I'm working through a book and trying to create a Game class in a header file which has a sprite as a private variable. I am getting the error "Constructor for 'Game' must explicitly initialize the member 'm_mushroom' [name of sprite] which does not have a default constructor" when I try to compile and can't seem to figure out why. I've tried initializing the sprite inside the default constructor by setting the texture, but this apparently doesn't work. Here is my code for the constructor:
Game(): m_window("Chapter 2", sf::Vector2u(800,600)) {
m_mushroomTexture.loadFromFile("path_to_mushroom_image_here");
m_mushroom.setTexture(m_mushroomTexture);
m_increment = sf::Vector2i(4,4);
}
This is with Xcode on macOS. Any ideas on what I'm doing wrong? Thanks.