Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ((Grid[right.i][right.j].getTexture() == &ground || Grid[right.i][right.j].getTexture() == &ground2)) {
- monster1.move(speed, 0.0);
- time = clock.getElapsedTime();
- if (time.asSeconds() >= 0.1) {
- clock.restart();
- p++;
- if (p > 8)
- p -= 8;
- }
- monster1.setTextureRect(IntRect(monster1_size.x*p, monster1_size.y * 3, monster1_size.x, monster1_size.y));
- /*if (Grid[up.i][up.j].getTexture() == &ground || Grid[up.i][up.j].getTexture() == &ground2) {
- flag = 0;
- }
- if (Grid[down.i][down.j].getTexture() == &ground || Grid[down.i][down.j].getTexture() == &ground2) {
- flag = 0;
- }*/
- }
- else if (Grid[up.i][up.j].getTexture() == &ground || Grid[up.i][up.j].getTexture() == &ground2) // Moving Up
- {
- monster1.move(0.0, -speed);
- time = clock.getElapsedTime();
- if (time.asSeconds() >= 0.1) {
- clock.restart();
- p++;
- if (p > 8)
- p -= 8;
- }
- monster1.setTextureRect(IntRect(monster1_size.x*p, monster1_size.y * 0, monster1_size.x, monster1_size.y));
- /*if (Grid[left.i][left.j].getTexture() == &ground || Grid[left.i][left.j].getTexture() == &ground2) {
- flag = 1;
- }
- if (Grid[right.i][right.j].getTexture() == &ground || Grid[right.i][right.j].getTexture() == &ground2) {
- flag = 1;
- }*/
- }
- else if (Grid[down.i][down.j].getTexture() == &ground || Grid[down.i][down.j].getTexture() == &ground2) // Moving Down
- {
- monster1.move(0.0, speed);
- time = clock.getElapsedTime();
- if (time.asSeconds() >= 0.1) {
- clock.restart();
- p++;
- if (p > 8)
- p -= 8;
- }
- monster1.setTextureRect(IntRect(monster1_size.x*p, monster1_size.y * 2, monster1_size.x, monster1_size.y));
- /*if (Grid[left.i][left.j].getTexture() == &ground || Grid[left.i][left.j].getTexture() == &ground2) {
- flag = 1;
- }
- if (Grid[right.i][right.j].getTexture() == &ground || Grid[right.i][right.j].getTexture() == &ground2) {
- flag = 1;
- }*/
- }
- else if ((Grid[left.i][left.j].getTexture() == &ground || Grid[left.i][left.j].getTexture() == &ground2)) // Moving Left
- {
- monster1.move(-speed, 0.0);
- time = clock.getElapsedTime();
- if (time.asSeconds() >= 0.1) {
- clock.restart();
- p++;
- if (p > 8)
- p -= 8;
- }
- monster1.setTextureRect(IntRect(monster1_size.x*p, monster1_size.y * 1, monster1_size.x, monster1_size.y));
- /*if (Grid[up.i][up.j].getTexture() == &ground || Grid[up.i][up.j].getTexture() == &ground2) {
- flag = 0;
- }
- if (Grid[down.i][down.j].getTexture() == &ground || Grid[down.i][down.j].getTexture() == &ground2) {
- flag = 0;
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement