X-Git-Url: http://deadsoftware.ru/gitweb?p=cavedroid.git;a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2Fmobs%2FPig.java;h=38eac46d69d9b70180df37400c86c70038bfbe34;hp=c615fcb0191c2828c58877b03454770d192e9dea;hb=be2690f1dee10f68a5ce6d576ace13c825ac5d15;hpb=18f9e2e6b8a17746e80f8332a7a57f6296678bdd diff --git a/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java b/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java index c615fcb..38eac46 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java +++ b/core/src/ru/deadsoftware/cavecraft/game/mobs/Pig.java @@ -10,7 +10,7 @@ public class Pig extends Mob { public Pig(int x, int y) { dir = MathUtils.random(1); - position = new Vector2(x, y); + pos = new Vector2(x, y); move = new Vector2(-1 + dir * 2, 0); width = 25; height = 18; @@ -31,17 +31,17 @@ public class Pig extends Mob { if (move.x != 0f) move.x = 0; else move.x = -1 + 2 * dir; } - if (move.x != 0f) animation += ANIM_SPEED; - else animation = 0; - if (animation >= 60 || animation <= -60) { + if (move.x != 0f) anim += ANIM_SPEED; + else anim = 0; + if (anim >= 60 || anim <= -60) { ANIM_SPEED = -ANIM_SPEED; } } @Override public void draw(SpriteBatch spriteBatch, float x, float y) { - Assets.pigSprite[0][1].setRotation(animation); - Assets.pigSprite[1][1].setRotation(-animation); + Assets.pigSprite[0][1].setRotation(anim); + Assets.pigSprite[1][1].setRotation(-anim); //back legs Assets.pigSprite[1][1].setPosition(x - 4 + (9 - dir * 9), y + 6); Assets.pigSprite[1][1].draw(spriteBatch); @@ -58,7 +58,7 @@ public class Pig extends Mob { @Override public Rectangle getRect() { - return new Rectangle(position.x, position.y, width, height); + return new Rectangle(pos.x, pos.y, width, height); } @Override