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.

40 lines
1.2 KiB

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