Bienvenue, Invité. Merci de vous connecter ou de vous inscrire. Avez-vous oublié d'activer ?

Voir les contributions

Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.


Sujets - TheYoungGeek43

Pages: « Précédente 1 [2]
16
Général / Une erreur de la SFML jamais compris
« le: Juillet 28, 2015, 12:22:15 pm »
Bonjour,

Defois j'ai des erreur avec la SFML que je ne comprend jamais defois avec un peut de chance j'arrive a enlever cette erreur mais la je n'y arrive pas
L'erreur est venus cette vois quand j'ai implémenter ma mitraillette
Erreur  1       error LNK2005: "class Bullets bullets" (?bullets@@3VBullets@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj    Humain vs Alien
Erreur  2       error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj    Humain vs Alien
Erreur  3       error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj    Humain vs Alien
Erreur  4       error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj      C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Main.obj    Humain vs Alien
Erreur  5       error LNK2005: "int bulletsSpeed" (?bulletsSpeed@@3HA) déjà défini(e) dans Human.obj C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj    Humain vs Alien
Erreur  6       error LNK2005: "class Bullets bullets" (?bullets@@3VBullets@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj    Humain vs Alien
Erreur  7       error LNK2005: "class Input input" (?input@@3VInput@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj    Humain vs Alien
Erreur  8       error LNK2005: "class Map map" (?map@@3VMap@@A) déjà défini(e) dans Human.obj        C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj    Humain vs Alien
Erreur  9       error LNK2005: "class Human human" (?human@@3VHuman@@A) déjà défini(e) dans Bullets.obj      C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Humain vs Alien\Mitraillette.obj    Humain vs Alien
Erreur  10      error LNK1169: un ou plusieurs symboles définis à différentes reprises ont été rencontrés C:\Users\FamilleMazet\documents\visual studio 2013\Projects\Humain vs Alien\Release\Humain vs Alien.exe Humain vs Alien
 
Main.cpp
#include <SFML\Graphics.hpp>
#include <iostream>
#include "Human.h"
#include "Input.h"
#include "Map.h"
#include "Bullets.h"
#include "Ennemy.h"
#include "Mitraillette.h"

using namespace std;

int main()
{
        const int screenWidth = 800;
        const int screenHeight = 480;

        sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight, 32), "Human vs Alien v 2.0", sf::Style::Default);
        window.setFramerateLimit(60);
       

        Human human;
        Input input;
        Map map;
        Bullets bullets;
        Ennemy ennemy;
        Mitraillette mitraillette;

        human.init(map,false);
        human.setLife(100);
       
        map.setLevel(1);
        map.changeLevel();

        bullets.init(window, map);

        ennemy.init(window);

        mitraillette.init(window);

        while (window.isOpen())
        {
                input.gestionInputs(window);
                human.update(input,window);

                window.clear();
                map.drawBackground(window);
                map.draw(2, window);
            map.draw(1, window);

                // Affiche le joueur
                human.draw(window, map);
                bullets.draw(window, map);
                mitraillette.update(window);
                ennemy.draw(window, map);

                map.draw(3, window);
                window.display();
        }
        return 0;
}
Mitraillette.h
#ifndef MITRAILLETTE_H
#define MITRAILLETTE_H

#include <SFML\Graphics.hpp>
#include "Human.h"
#include "Bullets.h"
#include "Input.h"
#include "Map.h"

Human human;
Bullets bullets;
Input input;
Map map;

class Mitraillette
{
public:
        Mitraillette();
       
        // Mutateur
        void Mitraillette::setMunition(int valeur);
        void Mitraillette::setRecharge(int valeur);
        void Mitraillette::setX(int valeur);
        void Mitraillette::setY(int valeur);

        //Accesseur
        int Mitraillette::getMunition(void) const;
        int Mitraillette::getRecharge(void) const;
        int Mitraillette::getX(void) const;
        int Mitraillette::getY(void) const;

        // Fonction
        void Mitraillette::init(sf::RenderWindow &window);
        void Mitraillette::update(sf::RenderWindow &window);

private:

        int munition;
        int recharge;
        int x, y;
        int direction, etat;
       
        enum { bulletU, BulletD, BulletL, BulletR };
        enum { ARRET, AVANCE };
};

#endif // !MITRAILLETTE_H
 

Mitraillette.cpp
#include "Mitraillette.h"


int humanPosX = human.getX();
int humanPosY = human.getY();
int bulletsSpeed = bullets.getSpeed();

Mitraillette::Mitraillette()
{
        x, y;
        munition;
        recharge;
        etat, direction;
}
// Accesseur
int Mitraillette::getX(void) const { return x; }
int Mitraillette::getY(void) const { return y; }
int Mitraillette::getMunition(void) const { return munition; }
int Mitraillette::getRecharge(void) const { return recharge; }

// Mutateur
void Mitraillette::setX(int valeur) { x = valeur; }
void Mitraillette::setY(int valeur) { y = valeur; }
void Mitraillette::setMunition(int valeur) { munition = valeur; }
void Mitraillette::setRecharge(int valeur) { recharge = valeur; }

//Fonction
void Mitraillette::init(sf::RenderWindow &window)
{
        x = humanPosX;
        y = humanPosY;
        munition = 30;
        recharge = 5;
        etat = 0;
        direction = 0;
}
void Mitraillette::update(sf::RenderWindow &window)
{
        if (input.getButton().shoot)
        {
                direction = BulletL;
                etat = AVANCE;
        }
        if (direction == BulletL && etat == AVANCE)
        {
                y += bulletsSpeed;
                bullets.draw(window, map);
        }
}

Merci pour vos explication

17
Général / Erreur de la SFML
« le: Juillet 26, 2015, 06:15:09 pm »
Bonjour,

Je suis entrain de coder un projet j'ai deja mis beacoup de chose et je compile apres avoir implementer les ennemy est la SFML me crache plusieur erreur
Erreur  1       error C2248: 'sf::NonCopyable::NonCopyable' : impossible d'accéder à private membre déclaré(e) dans la classe 'sf::NonCopyable'     D:\Dévellopement\SFML-2.3.1\include\SFML\Window\Window.hpp     521     1       Humain vs Alien
Erreur  2       error C2248: '
sf::NonCopyable::NonCopyable' : impossible d'accéder à private membre déclaré(e) dans la classe 'sf::NonCopyable'     D:\Dévellopement\SFML-2.3.1\include\SFML\Graphics\RenderTarget.hpp     419     1       Humain vs Alien
        3       IntelliSense : aucune instance du constructeur "sf::ContextSettings::ContextSettings" ne correspond à la liste d'arguments     d:\Dévellopement\SFML-2.3.1\include\SFML\Window\Window.hpp     89      114     Humain vs Alien
        4       IntelliSense : aucune instance du constructeur "sf::ContextSettings::ContextSettings" ne correspond à la liste d'
arguments     d:\Dévellopement\SFML-2.3.1\include\SFML\Window\Window.hpp     106     76      Humain vs Alien
        5       IntelliSense : aucune instance du constructeur "sf::ContextSettings::ContextSettings" ne correspond à la liste d'arguments     d:\Dévellopement\SFML-2.3.1\include\SFML\Window\Window.hpp     133     119     Humain vs Alien
        6       IntelliSense : aucune instance du constructeur "sf::ContextSettings::ContextSettings" ne correspond à la liste d'
arguments     d:\Dévellopement\SFML-2.3.1\include\SFML\Window\Window.hpp     151     72      Humain vs Alien

 

Main.cpp

#include <SFML\Graphics.hpp>
#include <iostream>
#include "Human.h"
#include "Input.h"
#include "Map.h"
#include "Bullets.h"
#include "Ennemy.h"

using namespace std;

int main()
{
        const int screenWidth = 800;
        const int screenHeight = 480;

        sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight, 32), "Human vs Alien v 2.0", sf::Style::Default);
        window.setFramerateLimit(60);
       

        Human human;
        Input input;
        Map map;
        Bullets bullets;
        Ennemy ennemy;

        human.init(map,false);
        human.setLife(100);
       
        map.setLevel(1);
        map.changeLevel();

        bullets.init(window, map);

        ennemy.init(window);

        while (window.isOpen())
        {
                input.gestionInputs(window);
                human.update(input,window);
                bullets.update(input, window, map);
                human.collisionE(ennemy, window, map);

                window.clear();
                map.drawBackground(window);
                map.draw(2, window);
            map.draw(1, window);

                // Affiche le joueur
                human.draw(window, map);
                //bullets.draw(window, map);
                ennemy.draw(window, map);

                map.draw(3, window);
                window.display();
        }
        return 0;
}

 

Ennemy.cpp
#include "Ennemy.h"


Ennemy::Ennemy()
{
        if (!ennemyTexture.loadFromFile("ennemy/ennemy.png"))
        {
                std::cout << "ERROR LOAD TEXTURE ENNEMY" << std::endl;
        }
        else
        {
                ennemySprite.setTexture(ennemyTexture);
        }

        x = y = 0;
        h = w = 32;
        life = 0;
        speed = 0;
}

int Ennemy::getX(void) const{ return x; }
int Ennemy::getY(void) const { return y; }
int Ennemy::getW(void) const { return w; }
int Ennemy::getH(void) const{ return h; }
int Ennemy::getLife(void) const{ return life; }
int Ennemy::getSpeed(void) const{ return speed; }

void Ennemy::setX(int valeur) { x = valeur; }
void Ennemy::setY(int valeur) { y = valeur; }
void Ennemy::setH(int valeur) { h = valeur; }
void Ennemy::setW(int valeur) { w = valeur; }
void Ennemy::setLife(int valeur) { life = valeur; }
void Ennemy::setSpeed(int valeur) { speed = valeur; }

void Ennemy::init(sf::RenderWindow &window)
{
        life = 100;
        if (life == 0)
        {
                ennemySprite.setPosition(sf::Vector2f(300, 200));
        }

}
void Ennemy::draw(sf::RenderWindow &window, Map &map)
{
        ennemySprite.setPosition(sf::Vector2f(100, 200));
        std::cout << "Ennemy life = " << life << std::endl;
        window.draw(ennemySprite);
}

 

Ennemy.h
#ifndef ENNEMY_H
#define ENNEMY_H

#include <SFML\Graphics.hpp>
#include "Map.h"

class Ennemy
{
public:
        Ennemy();

        //ACCESSEUR
        int Ennemy::getX(void) const;
        int Ennemy::getY(void) const;
        int Ennemy::getW(void) const;
        int Ennemy::getH(void) const;
        int Ennemy::getLife(void) const;
        int Ennemy::getSpeed(void) const;

        //MUTATEUR
        void Ennemy::setX(int valeur);
        void Ennemy::setY(int valeur);
        void Ennemy::setW(int valeur);
        void Ennemy::setH(int valeur);
        void Ennemy::setLife(int valeur);
        void Ennemy::setSpeed(int valeur);

        // Fonction
        void Ennemy::init(sf::RenderWindow &window);
        void Ennemy::draw(sf::RenderWindow &window, Map &map);
        void Ennemy::update(sf::RenderWindow &window);

private:

        int life = 100;
        int x, y, h, w;
        int speed;

        sf::Sprite ennemySprite;
        sf::Texture ennemyTexture;
};


#endif // !ENNEMY_H

 

Merci de me dire si vous avez besoin d'autre chose
Merci pour vos réponse

18
Général / Redimensionnement
« le: Juillet 25, 2015, 01:28:07 pm »
Bonjour,

je n'arrive pas a savoir comment faire pour interdire le redimensionnement de ma fenêtre

Merci pour vos réponse

19
Général / SFML bug de deplacement[resolus]
« le: Juillet 22, 2015, 11:23:53 pm »
Bonjour,

Je me suis mis a develloper un jeux avec la SFML sauf que je n'arrive pas a faire deplacer mon personnage
Voici mon code

Main.cpp
#include <SFML\Graphics.hpp>
#include <iostream>
#include "Human.h"
#include "Input.h"
 
using namespace std;
 
int main()
{
   sf::RenderWindow window(sf::VideoMode(800, 600, 32), "Human vs Alien");
   window.setFramerateLimit(60);
 
   Human human;
   Input input;
 
   human.init(window);
   human.setLife(100);
 
   while (window.isOpen())
   {
      input.gestionInputs(window);
      human.update(input);
 
      window.clear();
      human.draw(window);
      window.display();
   }
   return 0;
}

Input.h
#ifndef INPUT_H
#define INPUT_H
 
#include <SFML\Graphics.hpp>
 
class Input
{
   struct Button{ bool LEFT, RIGHT, UP, DOWN, SHOOT; };
public:
   // Constructeur
   Input::Input();
 
   //Accesseur
   Button Input::getButton(void) const;
 
   //Mutateur
   void Input::setButton(int bouton, bool etat);
 
   //Fonction
   void Input::gestionInputs(sf::RenderWindow &window);
   void Input::getInput(sf::RenderWindow &window);
 
 
private:
 
   // Variable de la classe en accès privé
   sf::Event event;
   Button button;
 
   //Enum pour les boutons
   const enum{ UP, DOWN, RIGHT, LEFT, SHOOT };
};
#endif // !INPUT_H

Input.cpp   
#include "Input.h"
 
// Constructeur
Input::Input()
{
   button.LEFT = button.RIGHT = button.UP = button.DOWN = button.SHOOT = false;
}
 
//Accesseur
Input::Button Input::getButton(void) const{ return button; }
 
//Mutateur
void Input::setButton(int bouton, bool etat)
{
   switch (bouton)
   {
   case UP:
      button.UP = etat;
      break;
   case DOWN:
      button.DOWN = etat;
      break;
   case RIGHT:
      button.RIGHT = etat;
      break;
   case LEFT:
      button.LEFT = etat;
      break;
   case SHOOT:
      button.SHOOT = etat;
      break;
   }
}
 
// Fonction
void Input::gestionInputs(sf::RenderWindow &window)
{
   //Pour l'instant, on ne gère que le clavier.
   //On gèrera les joysticks plus tard, s'il y en a
   //un de branché.
   //Pour l'instant, cette fonction n'est donc pas indispensable.
 
   getInput(window);
}
 
void Input::getInput(sf::RenderWindow &window)
{
   while (window.pollEvent(event))
   {
      switch (event.type)
      {
      case sf::Event::Closed:
         window.close();
         break;
 
      case sf::Event::KeyPressed:
         switch (event.key.code)
         {
         case sf::Keyboard::Escape:
            window.close();
            break;
 
         case sf::Keyboard::Left:
            button.LEFT = true;
            break;
 
         case sf::Keyboard::Right:
            button.RIGHT = true;
            break;
 
         case sf::Keyboard::Down:
            button.DOWN = true;
            break;
 
         case sf::Keyboard::Up:
            button.UP = true;
            break;
 
         default:
            break;
         }
         break;
 
      case sf::Event::KeyReleased:
         switch (event.key.code)
         {
         case sf::Keyboard::Left:
            button.LEFT = false;
            break;
 
         case sf::Keyboard::Right:
            button.RIGHT = false;
            break;
 
         case sf::Keyboard::Down:
            button.DOWN = false;
            break;
 
         case sf::Keyboard::Up:
            button.UP = false;
            break;
 
         default:
            break;
         }
         break;
 
         // on ne traite pas les autres type d'évènement
 
      }
   }
}

Human.h
   
#ifndef HUMAN_H
#define HUMAN_H
 
#include <SFML\Graphics.hpp>
#include "Input.h"
 
class Human
{
public:
 
   Human::Human();
 
   // Accesseur
   int Human::getX(void) const;
   int Human::getY(void) const;
   int Human::getW(void) const;
   int Human::getH(void) const;
   float Human::getDirX(void) const;
   float Human::getDirY(void) const;
   float Human::getStartX(void) const;
   float Human::getStartY(void) const;
   int Human::getLife(void) const;
   int Human::getMunition(void) const;
   int Human::getRecharge(void) const;
 
   // Mutateur
   void Human::setX(int valeur);
   void Human::setY(int valeur);
   void Human::setW(int valeur);
   void Human::setH(int valeur);
   void Human::setDirX(float valeur);
   void Human::setDirY(float valeur);
   void Human::setStartX(float valeur);
   void Human::setStartY(float valeur);
   void Human::setLife(int valeur);
   void Human::setMunition(int valeur);
   void Human::setRecharge(int valeur);
 
   //Fonction
   void Human::draw(sf::RenderWindow &window);
   void Human::init(sf::RenderWindow &window);
   void Human::update(Input &input);
 
private:
 
   sf::Texture humanTexture;
   sf::Sprite humanSprite;
 
   const int speedPlayer = 5;
   int x, y;
   int w,h;
   float dirX, dirY;
   float startX, startY;
   int munition;
   int recharge;
   int life;
   int etat, direction;
 
   enum { IDLE,LEFT, RIGHT, UP, DOWN, SHOOT };
};
 
 
 
#endif // !HUMAN_H

Human.cpp
   
#include <SFML\Graphics.hpp>
#include <iostream>
#include "Human.h"
#include "Input.h"
 
Input input;
 
Human::Human()
{
   if (!humanTexture.loadFromFile("player/human-bas.png"))
   {
      std::cout << "Erreur lors du chargement de HUMAN" << std::endl;
   }
   else
   {
      humanSprite.setTexture(humanTexture);
   }
   x = y = 0;
   w = h = 32;
   dirX = 0;
   dirY = 0;
   startX = 100;
   startY = 200;
   munition = 32;
   recharge = 3;
    life = 100;
 
}
 
void Human::init(sf::RenderWindow &window)
{
   x = y = 0;
   w = h = 32;
   dirX = 0;
   dirY = 0;
   startX = 100;
   startY = 200;
   munition = 32;
   recharge = 3;
   life = 100;
}
// Accesseur
int Human::getX(void) const{ return x; }
int Human::getY(void) const{ return y; }
float Human::getDirX(void) const{ return dirX; }
float Human::getDirY(void) const{ return dirY; }
float Human::getStartX(void) const  { return startX; }
float Human::getStartY(void) const  { return startY; }
int Human::getLife(void) const{ return life; }
int Human::getMunition(void) const{ return munition; }
int Human::getRecharge(void) const{ return recharge; }
 
// Mutateur
void Human::setX(int valeur){ x = valeur; }
void Human::setY(int valeur){ y = valeur; }
void Human::setDirX(float valeur){ dirX = valeur; }
void Human::setDirY(float valeur){ dirY = valeur; }
void Human::setStartX(float valeur) { startX = valeur; }
void Human::setStartY(float valeur) { startY = valeur; }
void Human::setLife(int valeur){ life = valeur; }
void Human::setMunition(int valeur){ munition = valeur; }
void Human::setRecharge(int valeur){ recharge = valeur; }
 
void Human::draw(sf::RenderWindow &window)
{
   /*humanSprite.setPosition(sf::Vector2f(startX - w, startY - h));*/
   window.draw(humanSprite);
}
void Human::update(Input &input)
{
   if (input.getButton().UP == true)
   {
      std::cout << "UP" << std::endl;
      y -= speedPlayer;
      direction = UP;
   }
   else if (input.getButton().DOWN == true)
   {
      std::cout << "DOWN" << std::endl;
      y += speedPlayer;
      direction = DOWN;
   }
   else if (input.getButton().RIGHT == true)
   {
      std::cout << "RIGHT" << std::endl;
      x += speedPlayer;
      direction = RIGHT;
   }
   else if (input.getButton().LEFT == true)
   {
      std::cout << "LEFT" << std::endl;
      x -= speedPlayer;
      direction = LEFT;
   }
}

Merci pour votre aide :D

20
Général / Visual Studio 2015
« le: Juillet 21, 2015, 01:00:27 am »
Bonjour,

Je souhaiterais savoir si il y a une date de prevus pour que SFML soit compatible avec Visual Studio 2015 qui est sorti hier je crois

Merci pour vos réponse

21
Général / Collision Pong
« le: Juillet 19, 2015, 01:35:50 pm »
Bonjour,

je fait un pong j'ai reussie a faire bouger ma balle mais ma méthode fait bugguer mes collision donc j'aurai voulut de l'aide (pour les collision je n'arrive pas utiliser le getBounds)

voila mon code
#include <SFML\Graphics.hpp>
#include <iostream>

using namespace std;

sf::CircleShape ball(10);
sf::RectangleShape paddle1;
sf::RectangleShape paddle2;

sf::Image icon;

int screenWidth = 800;
int screenHeight = 600;

float PI = 3.14;
void gestion_clavierP1();
void gestion_clavierP2();

sf::Vector2f ballSpeed(0.1, 0.1);

int main()
{
        sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight, 32), "Pong"); //Width Heigth

        ball.setPosition(sf::Vector2f(screenWidth / 2 - 10, screenHeight / 2 - 10));
        ball.setFillColor(sf::Color::Black);

        paddle1.setPosition(sf::Vector2f(10, screenHeight / 2 - 100));
        paddle1.setSize(sf::Vector2f(10, 100));
        paddle1.setFillColor(sf::Color::Black);

        paddle2.setPosition(sf::Vector2f(780, screenHeight / 2 - 100));
        paddle2.setSize(sf::Vector2f(10, 100));
        paddle2.setFillColor(sf::Color::Black);

        /**ICON**/
        if (!icon.loadFromFile("icon.png"))
        {
                cout << "L'icon n'a pas charger" << endl;
                EXIT_FAILURE;
        }
        else
        {
                window.setIcon(16, 16, icon.getPixelsPtr());
        }
       
        while (window.isOpen())
        {
                sf::Event event;

                while (window.pollEvent(event))
                {
                        if (event.type == event.Closed)
                        {
                                window.close();
                        }

                        gestion_clavierP1();
                        gestion_clavierP2();

                }
                /**Faire bouger la balle au demarrage**/
                ball.move(ballSpeed.x, ballSpeed.y);

                /*if ((paddle1.getPosition().y - 100) == (ball.getPosition().y - 10) || (paddle1.getPosition().x - 10) == (ball.getPosition().x - 10))
                {
                        cout << "COLLISION" << endl;
                        ball.move(-ballSpeed.x, ballSpeed.y);
                }*/

       
                /**Collision de la balle avec le mur**/
                if (ball.getPosition().y <= 0)
                {
                        cout << "COLLISION Y 1" << endl;
                        ball.move(ballSpeed.x, ballSpeed.y);
                }
                if (ball.getPosition().y >= screenHeight - 20)
                {
                        cout << "COLLISION Y 2" << endl;
                        ball.move(-ballSpeed.x, 0/*-ballSpeed.y*/);
                }
                if (ball.getPosition().x <= 0)
                {
                        cout << "COLLISION X 1" << endl;
                        ball.move(ballSpeed.x, 0);
                }
                if (ball.getPosition().x >= screenWidth - 20)
                {
                        cout << "COLLISION X 2" << endl;
                        ball.move(-ballSpeed.x, 0);
                }

                /**Colission paddle 1 avec le mur**/
                if (paddle1.getPosition().y <= 0)
                {
                        paddle1.setPosition(10, 0);
                }
                if (paddle1.getPosition().y >= screenHeight - 100)
                {
                        paddle1.setPosition(10, screenHeight - 100);
                }

                /**Colission paddle 2 avec le mur**/
                if (paddle2.getPosition().y <= 0)
                {
                        paddle2.setPosition(780, 0);
                }
                if (paddle2.getPosition().y >= screenHeight - 100)
                {
                        paddle2.setPosition(780, screenHeight - 100);
                }


                window.clear(sf::Color::White);
                window.draw(ball);
                window.draw(paddle1);
                window.draw(paddle2);
                window.display();
        }
}

void gestion_clavierP1()
{
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Z))
        {
                paddle1.move(0, -1.0f);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
        {
                paddle1.move(0, 1.0f);
        }
}
void gestion_clavierP2()
{
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        {
                paddle2.move(0, -1.0f);
        }
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
        {
                paddle2.move(0, 1.0f);
        }
}
 

22
Général / SFML Pong comment faire?
« le: Juillet 16, 2015, 06:44:53 pm »
Bonjour,

Je suis entrain de faire un pong mais je ne sait pas comment faire pour que la balle parte quand le jeux se lance (le pong et en un seul fichier Main.cpp pour l'instant après je ferait en plusieurs classe :) )

Merci pour votre aide :)

23
Général / IA
« le: Juillet 11, 2015, 06:25:14 pm »
Bonjour

je souhaiterais savoir si on peut faire de l'IA avec la SFML ?

Merci pour vos réponse

24
Général / OpenGL
« le: Juillet 10, 2015, 11:40:07 am »
Bonjour,

J'ai vus sur le site commet utiliser OpenGL avec SFML et je trouve que OpenGL est vraiment bien donc j'aurai souhaiter savoir si vous connaissez des tuto assez complet pour apprendre OpenGL?

Merci pour vos réponse

25
Général / Apprendre la SFML
« le: Juillet 02, 2015, 10:25:09 am »
Bonjour,

Je souhaiterait savoir si il existe un tuto pour apprendre la SFML(Au moins les base pour se demerder apres)

Merci pour vos réponse car j'arrive pas a trouver

26
Général / SFML c'est limite
« le: Juin 28, 2015, 11:45:56 am »
Bonjour,

J'aimerais connaitre les limites de la SFML ?

Merci de vos réponse.

27
Général / SFML => TiledMap
« le: Août 28, 2014, 03:17:02 pm »
Bonjour,

Esque l'on peut faire une map avec TiledMap et aprés l'utiliser avec SFML ?

28
Général / SFML bug
« le: Août 21, 2014, 11:43:36 am »
Salut,

Ces la premiere fois que j'utilise la SFML mais quand je fait le tuto mis sur le site officiel je rencontre un bug j'ai mis les propriété de mon projet comme le dit le site je met le code de test et Visual studio me sort une erreur

Erreur  1       error LNK1112: type d'ordinateur module 'x64' en conflit avec le type d'ordinateur cible 'X86'  C:\Users\*******\documents\visual studio 2012\Projects\SFML-Learning\SFML-Learning\sfml-graphics.lib(sfml-graphics-2.dll)       SFML-Learning
 

PS : j'ai télécharger SFML 64bit et mon PC est un 64bit

Pages: « Précédente 1 [2]
anything