Created
October 15, 2019 13:31
-
-
Save niiicolai/d3b7272112611e81aad12778e95d3de4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Humanoid extends GameObject { | |
| public HealthController healthCtrl; | |
| public Animator animator; | |
| Humanoid(PVector _position, PVector _size, | |
| float _maxHealth, AnimationState[] animationStates) { | |
| // Execute GameObject constructor | |
| super(_position, _size); | |
| // Set required components | |
| boxCollider = new BoxCollider(this); | |
| healthCtrl = new HealthController(_maxHealth); | |
| animator = new Animator(animationStates); | |
| } | |
| public void display() { | |
| // Execute play() on the animator in order to play the | |
| // current animation | |
| animator.play(); | |
| // Draws an image based on the current animation image | |
| image(animator.animationImage(), position.x, position.y, | |
| size.x, size.y); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment