You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

2 years ago
  1. package gameobjects;
  2. import java.util.LinkedList;
  3. import playground.Playground;
  4. import playground.Animation;
  5. import collider.Collider;
  6. import collider.RectCollider;
  7. import rendering.*;
  8. import org.apache.logging.log4j.Logger;
  9. import org.apache.logging.log4j.LogManager;
  10. public class AnimatedGameobject extends GameObject {
  11. protected AnimationArtist animArtist;
  12. private static Logger logger = LogManager.getLogger(AnimationArtist.class);
  13. // auto-generates collider according to box width/height
  14. public GameObject generateColliders() {
  15. logger.debug("Created animated Obj "+ this.animArtist.getW()+" "+this.animArtist.getH()) ;
  16. double w = this.animArtist.getW() ;
  17. double h = this.animArtist.getH() ;
  18. this.addCollider(new RectCollider("RectColl_" + this.id, this, w,
  19. h)) ;
  20. logger.info("ANIMGO-COLL ID="+this.getId()+" WH= "+w+"/"+h) ;
  21. return this ;
  22. }
  23. public AnimatedGameobject(String id, Playground pg, double x, double y, double vx, double vy,
  24. double scale, Animation anim, double t0, String abspielmodus) {
  25. super(id, pg, x, y, vx, vy); // Konstruktor-Aufruf GameObject
  26. this.artist = new AnimationArtist(this, anim, t0, abspielmodus, scale);
  27. this.animArtist = (AnimationArtist) (this.artist);
  28. }
  29. }