Class CircleShape

  • Kennet_DK
    Likes 0

    Problem Description

    Hello Sonar Systems :) I'm a new SFML user and have watched your video and like them. And learned from them.watched Frogger Part 2 and trying to understand how to make a Class I understand it with a rectangle shape. I'm wise to try to make a Circle shape the way you make Frogger. But it is harder. Have watched the web for a CircleShape Class. Perhaps you could publish a video Circleshape Class in the same way as the Frogger Class. I'll be so happy, making my first game and going to use circleShape Class. Hope you can help me teacher Thank you Kennet :) 

    I can not use vector2u to make radius in a circle So i tried float Boot it is not so is Easily   Help!!!!!

     

    Main.cpp

          Ball ball(window.getSize());                                This line Problem !
          ball.setPosition(sf::Vector2f());
         

    Ball.h

          #pragma once

          #include<SFML\Graphics.hpp>


         class Ball
         {
         public:
             Ball (float Radius);                               This line Problem !
        
            void setPosition(sf::Vector2f newPos);

            void draw(sf::RenderWindow &window);


             //sf::CircleShape getShape();

         private:
            sf::CircleShape ball;
            float radius;
         };

     

    Ball.Cpp

         #pragma once

         #include"Ball.h"


         Ball::Ball(float)                                                 Problem !
         {
            ball.setRadius(10);                                         Problem!
         }

          void Ball::setPosition(sf::Vector2f)
         {
          ball.setPosition(sf::Vector2f(200, 200));
         }

          void Ball::draw(sf::RenderWindow &window)
         {
               window.draw(ball);
          }

     

     

    Hope you Can help me 

     Kennet

  • Sonar Systems admin
    Likes 0

    When you say problem, do you get errors/warnings?

Login to reply