Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - riadh

Pages: [1]
1
Audio / Re: problem with playing second music
« on: December 28, 2012, 12:23:18 am »
Solved , : my code is correct , just need to put it out of the while(opned)

2
Audio / Re: problem with playing second music
« on: December 28, 2012, 12:06:26 am »
And now provide a complete example, so we actually see what's going on. ;)
Stopping music and closing music are two different terms, so use the one that actually describes the action.

and how to close the music ??  there aren't a function called close :/

3
Audio / Re: problem with playing second music
« on: December 27, 2012, 11:56:59 pm »
Rather than make some (hard to read, due to the lack of using a proper list or adding a space between the dash and I) listing, you should provide a complete and minimal example, that reproduces the problem.

What exactly do you mean by 'I close the first music'? And what's your 'new music'? ;)


at the first
 backMusic.OpenFromFile("src/jungle_1.ogg");
    backMusic.SetLoop(true);
    backMusic.Play();
 


in the seconde window
    backMusic.Stop();
    lostMusic.OpenFromFile("src/dead.ogg");
    lostMusic.SetLoop(true);
    lostMusic.Play();
 

4
Audio / [solved]problem with playing second music
« on: December 27, 2012, 11:47:22 pm »
Hello , in my game i have this
-i play a background music ,
-then i closed the window ,
-i opned a new one
-i close the first muic
-i play new musc
---> the new musc doesn't start
do u know why ?
Thanks

5
Graphics / Re: resource ?
« on: December 27, 2012, 11:05:45 am »

There are hundreds of sites that provide resources, you just need to search for them (make sure the license allows you to use it), but I don't know if you'll find something like that...
If you want exactly what you've go in your mind, then get an artist to do it. ;)

just what key word should i use ? background for 2D games ?


It all depends on your game. If you have just one fixed background per level, it probably would be better to have one separated image for each level, but if the player can move around on the background it's probably better to have one texture and move the sf::View (aka camera) on top of it.
see my video and tell, it's easier to put one background behind the map , but would it make it slow if it's a big file ? (3000 * 600 ) 

6
Graphics / resource ?
« on: December 27, 2012, 10:39:36 am »
hello , where can i find nice background for my game like this one ?
http://www.skrinn.com/pics/t/20-1.png?1356600950

and should i put it on the Window for all the level  (i mean to make it size 800, 3000)? or try to add it to the camera so it will keep the same 800*600 picutre ??

Thanks

7
General / Re: Need help with map collsion Here is my game , your opinion ?
« on: December 24, 2012, 12:21:24 am »
but asking if there are a tutorial talking about this stuff on sfml why not to put here
Well if there was a tutorial for collision detection regarding tile-maps and specifically for SFML that I'd know of, I would've linked it long time ago. ::)
I guess you'll find some sample code in the forum somewhere and if you're ever curious about tutorials/source code for SFML, you can check on your own on the official SFML wiki. :)
thanks,  i think of making a tutorial of this if i made it :D

8
General / Re: Need help with map collsion Here is my game , your opinion ?
« on: December 23, 2012, 11:18:36 pm »
but no one of your replies helped me to know what exactly should i do , why i have never found any article or tutorial talking about collision with map while it's a fundamental thing :( ,

the first thing is the code in the map.cpp wich must be changed ?
for the player just getboundingbox is ok ?
We won't program for you (unless you pay us), but we only give points in the direction you should go, if you don't have enough knowledge on how to approach things you can ask again, but if you don't know at all where to start, it seems to me that you like some major knowledge in programming, which is required for the level you want to achieve things.

So our posts didn't say do X in file Y, but we gave you the idea you want, mainly: "Do a collision detection with each tile in the map that is interesting for the player."
If you don't understand that instruction you should ask again, but don't expect us to 'fix'/write code for you. ;)

Also if you haven't found anything on collision with maps etc. with Google, then I'd say you didn't search hard enough or with smart enough keywords...


hello  ; i know i'm not asking you to write the code for me , but asking if there are a tutorial talking about this stuff on sfml why not to put here , unless im' going to try your solution and then ask u again if i found some problem

9
General / Re: Need help with map collsion Here is my game , your opinion ?
« on: December 23, 2012, 06:47:05 pm »
i know that all my collision code should be in the trash hhh
i don't know if it would be a good idea to think about box2d in this short time

but no one of your replies helped me to know what exactly should i do , why i have never found any article or tutorial talking about collision with map while it's a fundamental thing :( ,

the first thing is the code in the map.cpp wich must be changed ?
for the player just getboundingbox is ok ?
thanks for your help

10
General / Re: Need help with map collsion Here is my game , your opinion ?
« on: December 23, 2012, 04:04:20 pm »
any idea ?

11
General / Re: Need help with map collsion Here is my game , your opinion ?
« on: December 22, 2012, 12:33:47 pm »
the problem isn't in the collision between 2 boundingBox for example, but is about how to check if there are a collison with the map wich is created with a mapVector, i will put my code now :)

12
General / [modified] map collision
« on: December 22, 2012, 12:05:38 pm »
Hey , i think that i have found the problem when in the main , i delete map1.draw(app) , i mean i stop drawing the map i think it works better , the drawing of map takes a lot of time that's why the player don't fit in his place , so i think now i must modify the Draw function to optimize it , i think that i will use only unsigned value then try to do more ,
What do u think guys ?


(im using a collision with a y = 480 just to test  ( i tested it with the old collision and a big diffrence too :) )








Hello everybody , i'm new here , but i have searched and didn't found any similar topic where i can find a solution
first of all here is a video of my game, (in progress)
it's a video of yesterday


if you see the collision with the map is really ridicules :(( i have done it by my self and i know it's wrong
 can anyone help me ? i can post my code (it's a real mess :(  )

thanks for your support :)
you Friend from Tunisia
----------------------
i'm working with sfml 1.6 and here player update code

void Player::Update(sf::RenderWindow &Window , int downElement , int rightElement , int leftElement, int topElement , IntRect underBox , int underBoxValue )
{

    const Input & input = Window.GetInput();
    PlayerVelocity.x = 0 ;
    //cout<<"underBoxValue"<< underBoxValue <<endl;


    //PlayerVelocity.y += gravity * Window.GetFrameTime();
     //gravitĂ©
    if(  (!jump ) )
    {
         PlayerVelocity.y += gravity * Window.GetFrameTime();

    }
    else
    {
        PlayerVelocity.y  = 0 ;
    }






    if(input.IsKeyDown(Key::Right))
    {   if(rightElement != 1 && rightElement != 2)
        {
            PlayerVelocity.x = moveSpeed ;
        }

        currentFrameY = 1;
    }
      if(input.IsKeyDown(Key::Left))
    {   if(leftElement != 1 && leftElement != 2)
        {
             PlayerVelocity.x = -moveSpeed ;

        }

        currentFrameY = 0;
    }
      if(input.IsKeyDown(Key::Up) && jump )
    {

           PlayerVelocity.y = -jumpSpeed ;
           jump = false ;

      //  y -= moveSpeed  * Window.GetFrameTime();
    } //else


//  1ere methode pr fixĂ© le joueur a sol CollisionManager::collsion2Box(this->GetBoundingBox(),underBox  )
      if(   (downElement == 1  || downElement == 2) )
    {

        PlayerVelocity.y = 0 ;
        PlayerPosition.y = underBox.Top - 50    ;
        jump = true ;


    }
    else if ( underBoxValue == -1 && jump )
    {
        //PlayerVelocity.y = jumpSpeed /2;
        jump = false ;
    }


        if ((topElement == 1 || topElement == 2)  && (!jump  ) && (leftElement != 1 && leftElement != 2)  && rightElement !=1 && rightElement!= 2  ) // ki yodhreb fi 7aja mel fou9
    {
        PlayerVelocity.y = +jumpSpeed / 3;
    }


    if(PlayerVelocity.x==0)
    {
        playerAnimation.setActive(false) ;
    }
    else playerAnimation.setActive(true) ;

    PlayerPosition += PlayerVelocity * Window.GetFrameTime();



    playerAnimation.setPosition(1, PlayerPosition.x);
    playerAnimation.setPosition(2, PlayerPosition.y  );
    playerAnimation.setCurrentFrame(2, currentFrameY);
    playerAnimation.Update(Window);

}
 

on the main
int underBoxValue  ;
        IntRect underBox = map1.getUnderBox(player , app, underBoxValue) ;

        player.Update(app , map1.getDownElement(player , app) , map1.getRightElement(player, app) ,map1.getleftElement(player , app) , map1.getTopElement(player, app) , underBox, underBoxValue);
 


on map.cpp

int Map::getDownElement(Player p , RenderWindow &Window)
{


    //if(screenCapture.GetPixel(p.getX(),p.getY())  ==  );

    int i =    round  (( p.GetBoundingBox().Left +5 ) / BLOCKSIZE ) ;
    int j =     round ((p.GetBoundingBox().Top  ) / BLOCKSIZE ) ;
    //int    pos = -1 ;

int pos ;

       pos = MapVector[j+1][i] ;

  if (pos  == 0 )
  {
      cout <<"deboredment"<<endl ;
      //p.playerAnimation.setPosition(1,50);
      p.killed(Window);

  }

    return pos  ;
}

int Map::getRightElement(Player p , RenderWindow &Window)
{


    //if(screenCapture.GetPixel(p.getX(),p.getY())  ==  );

    int i =    (( p.GetBoundingBox().Right +14)/ BLOCKSIZE ) ;
    int j =   ( ( p.GetBoundingBox().Bottom + 10) / BLOCKSIZE ) ;
    int    pos  ;



       pos = MapVector[j][i] ;



    return pos  ;
}

int Map::getleftElement(Player p , RenderWindow &Window)
{


    //if(screenCapture.GetPixel(p.getX(),p.getY())  ==  );

    int i =    (( p.GetBoundingBox().Left + 2)/ BLOCKSIZE ) ;
    int j =   ( (p.GetBoundingBox().Bottom + 10) / BLOCKSIZE ) ;
    int    pos ;



       pos = MapVector[j][i] ;

  if (pos  == 0 )
  {cout <<"deboredment"<<endl ; }

    return pos  ;
}

int Map::getTopElement(Player p , RenderWindow &Window)
{


    //if(screenCapture.GetPixel(p.getX(),p.getY())  ==  );

    int i =    (( p.GetBoundingBox().Left + 20 )/ BLOCKSIZE ) ;
    int j =   ( (p.GetBoundingBox().Bottom + 5 )/ BLOCKSIZE ) ;
    int    pos ;



       pos = MapVector[j-1][i] ;



    return pos  ;
}

 

Pages: [1]
anything