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.


Topics - riadh

Pages: [1]
1
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

2
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

3
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