Skip to content

Commit

Permalink
When moving, test collisions for x/y separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zutty committed Apr 1, 2012
1 parent 9ed6a40 commit 23017e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/uk/co/zutty/evilville/entities/Mob.as
Expand Up @@ -147,9 +147,13 @@ package uk.co.zutty.evilville.entities
}

// Actually move
var c:Entity = collideTypes(["mob", "terrain"], x + move.x, y + move.y);
if(!c) {
var c:Entity;
c = collideTypes(["mob", "terrain"], x + move.x, y);
if(c == null) {
x += _move.x;
}
c = collideTypes(["mob", "terrain"], x, y + move.y);
if(c == null) {
y += _move.y;
}

Expand Down

0 comments on commit 23017e4

Please sign in to comment.