Skip to content

Commit

Permalink
made it so you can't attack while being knocked back
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj42 committed Feb 7, 2018
1 parent 825b1d6 commit e7b557b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/src/miniventure/game/world/entity/mob/Mob.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public Mob(@NotNull String spriteName, int health, @NotNull ItemDrop... deathDro

public Direction getDirection() { return dir; }

public boolean isKnockedBack() { return knockbackTimeLeft > 0 && knockbackVelocity.len() > 0; }

@Override
public void render(SpriteBatch batch, float delta) {
blinker.update(delta);
Expand Down
10 changes: 6 additions & 4 deletions core/src/miniventure/game/world/entity/mob/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ public void checkInput(@NotNull Vector2 mouseInput) {

move(movement.x, movement.y);

if(pressingKey(Input.Keys.C))
attack();
else if(pressingKey(Input.Keys.V))
interact();
if(!isKnockedBack()) {
if (pressingKey(Input.Keys.C))
attack();
else if (pressingKey(Input.Keys.V))
interact();
}

hands.resetItemUsage();

Expand Down

0 comments on commit e7b557b

Please sign in to comment.