public GameObject( Bitmap objectBitmap, String id, SpriteData sd, BasicMovement basicMovement, AI ai) { this.id = id; this.objectBitmap = objectBitmap; if (sd != null) { this.sprite_init_x_pos = sd.getInitX(); this.sprite_init_y_pos = sd.getInitY(); this.width = sd.getWidth(); this.height = sd.getHeight(); } setDefaultMovement(basicMovement); setAI(ai); }
/** * Increases the experience of Player (variable inherited by Character). If experience exceeds * expToLevel, increment level by one and set experience to the remaining experience after * reaching expToLevel. * * @param exp current value of experience */ public void increaseExp(int exp) { SpriteData s = getSpriteData(); s.increaseExp(exp); while (s.canLevel()) { int toNextLevel = s.getExpToLevel() * s.getLevel() / 2; increaseCurrentLevel(); s.setStat(Stats.EXPTOLEVEL, toNextLevel); } }