Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private GameLoopMethod()
- {
- // Doing derp stuff
- Coordinates newCoords = followPotatoes(x, y, a, b);
- myObjectThatNeedsToFollowStuff.x = newCoords.xCoord;
- myObjectThatNeedsToFollowStuff.y = newCoords.yCoord;
- }
- private Coordinates followPotatoes(int x, int y, int a, int b)
- {
- if (a != x) {
- if (a < x) {
- a += 1;
- } else {
- a -= 1;
- }
- }
- if (b != y) {
- if (b < y) {
- b += 1;
- } else {
- b -= 1;
- }
- }
- Coordinates returnCoords = new Coordinates(a, b);
- return returnCoords;
- }
- ===
- DIFFERENT FILE
- ===
- public class Coordinates
- {
- public int xCoord;
- public int yCoord;
- public Coordinates(int x, int y) {
- xCoord = x;
- yCoord = y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement