2
« on: January 07, 2012, 04:40:45 am »
This seems to be a much better way to accomplish what I was attempting.
while (window.PollEvent(event)) {
processEvents(window, event);
switch (event.Type) {
case sf::Event::KeyReleased:
if (event.Key.Code == sf::Keyboard::Up) {
moveHero(dave.location,dave.location = dave.location -= X_TILES);
break;
}
if (event.Key.Code == sf::Keyboard::Down) {
moveHero(dave.location,dave.location = dave.location += X_TILES);
break;
}
if (event.Key.Code == sf::Keyboard::Left) {
moveHero(dave.location,dave.location = dave.location -= 1);
break;
}
if (event.Key.Code == sf::Keyboard::Right) {
moveHero(dave.location,dave.location = dave.location += 1);
break;
}
default:
break;
}
}
Thanks