Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Sprite::step(int delta, SDL_Event event) {
- if (controller) {
- int space = delta * speed;
- // printf("Sprite[%s] will move %d on delta %d\n",name,space,delta);
- controller->step(delta, event);
- if (controller->canUp()) {
- pos.y -= space;
- direction = up;
- } else if (controller->canDown()) {
- pos.y += space;
- direction = down;
- }
- if (controller->canRight()) {
- pos.x += space;
- direction = right;
- } else if (controller->canLeft()) {
- pos.x -= space;
- direction = left;
- }
- if (controller->moved()) {
- cur += delta;
- if (cur > tpf) {
- cur = 0;
- anim++;
- anim %= seq->size();
- }
- } else
- anim = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement