protected void specificUpdate(GameTime gameTime) { this.applyGravity(); super.de.update(gameTime); if (!this.actable && (MathUtils.abs((float) (this.Pos.x - this._player.Pos.x)) <= this.actDis)) { this.actable = true; } if (this.actable) { super._Paused = false; if (super._Frame == 8) { super._TimePerFrame = 0.06666667f; super.setAnimation(new int[] {9, 10, 11, 10}); this.moveable = true; } } if (this.moveable) { if ((this.Pos.x - this._player.Pos.x) >= 0f) { this.i_am_hardly_walking_to_left = true; this.i_am_hardly_walking_to_right = false; this.isfacingToLeft = true; this.Pos.x -= this.VX; } else { this.i_am_hardly_walking_to_left = false; this.i_am_hardly_walking_to_right = true; this.isfacingToLeft = false; this.Pos.x += this.VX; } } super.color = LColor.white; }
@Override public void update(int elapsedTime) { super.update(elapsedTime); if (stunned <= 0.0) { // TODO: Different logic facePlayer(); approachPlayer(); } }
@Override public void update(GameContainer gameContainer, int deltaTime) throws SlickException { animations[animType].update(deltaTime); super.update(gameContainer, deltaTime); if (isAttacking) { long delta = world.getGame().getGameContainer().getTime() - attackStart - getAttackOffsetTime(); if (delta >= ATTACK_MISSILE_WAIT * missileIndex && missileIndex < PROJECTILE_COORDINATES.length) { Tadpole tadpole = new Tadpole(this, getTadpoleAttack()); getWorld().addEntity(tadpole); missileIndex++; } } }
@Override public void update(float dt, ArrayList<GameObject> objects) { super.update(dt, objects); if (!usingAction && !activityTimer.isDone()) { activityTimer.update_timer(dt); } if (activityTimer.isDone()) { usingAction = true; this.animationManager.changeAnimation("MovementGlow", 30, false); activityTimer.reset_timer(); } if (this.animationManager.getCurrentAnimation().equals("MovementGlow") && this.animationManager.isDone()) { this.room.spawn_object(new XP(this.draw, this.sounds, this.textures, this)); usingAction = false; this.animationManager.changeAnimation("Movement", 30, true); } }
@Override public void run() { // update game and update animations while (true) { player.update(); for (Enemy e : enemies) { e.update(); } for (Wall w : walls) { w.update(); } repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { e.printStackTrace(); } } }
@Override public void update() { super.update(); moveTowardsPlayer(0.05f); }