Finally I went for 2d matrix holding the gameobjects.
now the next step is being checked instead of the whole drawable objects.
but now I have graphic issues.
since i saved all of the objects in a matrix i have a canMove() function
that checks if the next move is legit.
if so the sprite moves to that direction (32b) but it jumps to it instead of
smoothly going there.
i thought of using the elapsedtime option but i have no idea how to use it
so the matrix checks will keep happening while pressing.
well here is the code, hope you can help me figure out what to do ty!!!
[quote]
while(App.IsOpened())
{
while(App.GetEvent(event))// quit or switch players
{
if (event.Type == sf::Event::Closed)// close program
App.Close();
if (App.GetInput().IsKeyDown(sf::Key::Escape))
App.Close();
if ((event.Type == sf::Event::KeyPressed)&&
(event.Key.Code == sf::Key::P))// switch players
i++;
if (i==_moveables.end())
i=_moveables.begin();
}
if (App.GetInput().IsKeyDown(sf::Key::Left)) // move left
if ((**i).canMove(-1,0,_world))
(**i)._sprite.Move(-32,0);
if (App.GetInput().IsKeyDown(sf::Key::Right))
if ((**i).canMove(+1,0,_world))
(**i)._sprite.Move(+32,0);
if (App.GetInput().IsKeyDown(sf::Key::Up))
if ((**i).canMove(0,-1,_world))
(**i)._sprite.Move(0,-32);
if (App.GetInput().IsKeyDown(sf::Key::Down))
if ((**i).canMove(0,+1,_world))
(**i)._sprite.Move(0,+32);
App.Clear(); // clear window
drawStuff(App);// draw all drawable vector.
App.Display(); // display
[color=red]Sleep(24); // for not moving too fast[/color] // do i need this?
xMove=0;yMove=0;
[/quote]
sorry quote and code arent working O_O