diff options
author | Tom Barrett <tombarrett@cornell.engr.siu.edu> | 2015-05-06 11:49:31 -0500 |
---|---|---|
committer | Tom Barrett <tombarrett@cornell.engr.siu.edu> | 2015-05-06 11:49:31 -0500 |
commit | a67acef63379f9fd9f5bd983b70a81c50c544eda (patch) | |
tree | 0b95c2a8bea089773b3b3be21336d8c48ae9461e | |
parent | aaf0a73578ecbb8212e0d224d6fff68a229b1f48 (diff) |
changed the movement to no longer move randomly
-rw-r--r-- | src/creature.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/creature.cpp b/src/creature.cpp index cc3fa08..2e5e1ab 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -49,6 +49,36 @@ void Creature::Action() else x--; } + else if(x<xT) + { + if(y<yT) + { + x++; + y++; + } + else + { + x++; + y--; + } + } + else if (x>xT) + { + if(y<yT) + { + x--; + y++; + } + else + { + x--; + y--; + } + } + + + + /* else { int z = rand()%2; @@ -67,6 +97,7 @@ void Creature::Action() y--; } } + */ } Location Creature::getLocation() |