public void reset() { this.idleTexture.reset(); this.leftTexture.reset(); this.rightTexture.reset(); this.upTexture.reset(); this.downTexture.reset(); this.activeTexture = this.idleTexture; }
public AnimatedCharacter(String name, ContentUtil content, long beatTimeInMs) { this.idleTexture = this.loadTexture(content, name + "_idle", beatTimeInMs); this.upTexture = this.loadTexture(content, name + "_up", beatTimeInMs); this.upTexture.repeat = false; this.leftTexture = this.loadTexture(content, name + "_left", beatTimeInMs); this.leftTexture.repeat = false; this.rightTexture = this.loadTexture(content, name + "_right", beatTimeInMs); this.rightTexture.repeat = false; this.downTexture = this.loadTexture(content, name + "_down", beatTimeInMs); this.downTexture.repeat = false; this.reset(); }
public void activate(InputState.Move move) { AnimatedTexture activate = this.idleTexture; if (InputState.Move.UP == move) { activate = this.upTexture; } else if (InputState.Move.DOWN == move) { activate = this.downTexture; } else if (InputState.Move.LEFT == move) { activate = this.leftTexture; } else if (InputState.Move.RIGHT == move) { activate = this.rightTexture; } if (this.activeTexture == activate && !this.activeTexture.stopped) { return; } this.activeTexture = activate; this.activeTexture.reset(); }
private AnimatedTexture loadTexture(ContentUtil content, String name, long time) { Texture2D tex = content.load<Texture2D>(name); AnimatedTexture anim = new AnimatedTexture(tex, time); return anim; }