its basicly the same from previous jsut constructor changes
sinking cpp
sinkingObstacle::sinkingObstacle(const Image &Img, const Vector2f &Position, const Vector2f &Scale, float Rotation, const Color &Col, float scrollPos):Obstacle(Img,Position,Scale,Rotation,Col,scrollPos)
{
std::cout<<getScrollPos()<<std::endl;
}
sinkingObstacle::sinkingObstacle():Obstacle()
{
}
obstacle cpp
Obstacle::Obstacle(const Image &Img, const Vector2f &Position, const Vector2f &Scale, float Rotation, const Color &Col, float scrollPos):Sprite (Img ,Position, Scale, Rotation, Col)//,scrollposition(scrollPos)
{scrollposition=scrollPos;
}
Obstacle::Obstacle():Sprite()
{
}
error
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <sstream>
#include "obstacle.h"
#include "explosiveObstacle.h"
#include "sinkingObstacle.h"
#include "Scroller.h"
#include "AnimatedSprite.h"
#include "game.h"
#include "submarine.h"
#include <cmath>
#include <time.h>
int main()
{
//initialisation - lots of this code could be put into functions for
//neatness and separation of concerns. You need to declare objects here to draw them
//but the set up for those objects could be done in a function or a class
//window dimensions
unsigned int width=600;
unsigned int height=480;
Game newgame(0,0);
//we need a timer to update things - get a clock
sf::Clock clock;
static float timeAccumulator=0.0;
//load resources for the scroller - images and sounds (if you have any)
sf::Image backGround;
if(!backGround.LoadFromFile("images/underwater.jpg")) std::cout<<"File not found background.jpg"<<std::endl;
sf::Image Rock;
if(!Rock.LoadFromFile("images/rock.png")) std::cout<<"File not found SpriteRock.png"<<std::endl;
//sf::Sprite SpriteRock;
sf::Image seamine;
if(!seamine.LoadFromFile("images/seamine.png")) std::cout<<"File not found seamine.png"<<std::endl;
//sf::Sprite SpriteSeamine;
sf::Image shipreck;
if(!shipreck.LoadFromFile("images/shipreck.png")) std::cout<<"File not found shipreck.png"<<std::endl;
//sf::Sprite SpriteShipreck;
Submarine newsub(100);
newsub.Init("images/submarine.png");
newsub.getEnergy();
float random = sf::Randomizer::Random(0.f,1.f);
sf::Sprite backGndSprite(backGround);
backGndSprite.Scale(0.75f,0.8f);
//declare obstacles here
//Obstacle ObsRock(Rock);
//set up the scroller data
//sinkingObstacle Seamine(seamine);
sinkingObstacle Seamine(seamine);//error here
my main game loop