/** add a bitmap font */
 public BitmapFont addBitmapFont(String id, BitmapFont font) {
   if (font == null) {
     return null;
   }
   fontMap.put(id, font);
   return font;
 }
 /** add a sound */
 public Sound addSound(String id, Sound sound) {
   if (sound == null) {
     return null;
   }
   soundMap.put(id, sound);
   return sound;
 }
 /** Add a texture region */
 public TextureRegion addTextureRegion(String id, TextureRegion t) {
   if (t == null) {
     return null;
   }
   regionMap.put(id, t);
   return t;
 }
 public TextureRegion[] addAnimations(String id, TextureRegion[] regions) {
   if (regions == null) {
     return null;
   }
   animationFrames.put(id, regions);
   return regions;
 }
 /** Add a texture. if texture exist, it will be overwrite. */
 public Texture addTexture(String id, Texture t) {
   if (t == null) {
     return null;
   }
   textureMap.put(id, t);
   return t;
 }
  @Override
  public void draw(Batch batch, float parentAlpha) {
    ArrayMap<Texture, Integer> layers = new ArrayMap<Texture, Integer>();
    float[][] offsets = {
      {mHeight, 0},
      {290, 0},
      {130, 50},
      {100, 50},
      {100, -30}
    };

    layers.put(mSky, 16);
    layers.put(mFarGround, 14);
    layers.put(mMiddleGround, 12);
    layers.put(mNearGround, 10);
    layers.put(mGrass, 1);

    //        Gdx.app.log(TAG, "pos " + mPosition + " scale " + mScale);

    int i = 0;
    Iterator<ObjectMap.Entry<Texture, Integer>> iter = layers.iterator();

    while (iter.hasNext()) {
      ObjectMap.Entry<Texture, Integer> next = iter.next();

      float top = offsets[i][1];
      float pos = mPosition / 10000 * next.value;
      float delta = pos >= 0 ? -mWidth * (pos - (int) pos) : -mWidth - mWidth * (pos - (int) pos);

      batch.draw(next.key, delta - mWidth, top, mWidth, offsets[i][0]);

      batch.draw(next.key, delta, top, mWidth, offsets[i][0]);

      batch.draw(next.key, delta + mWidth, top, mWidth, offsets[i][0]);

      batch.draw(next.key, delta + mWidth * 2, top, mWidth, offsets[i][0]);

      if (i == 0) {
        batch.draw(next.key, delta - mWidth, -200, mWidth * 4, 200, 0, 1, 1, 0.99f);
      }

      i++;
    }
  }
 public AlienShooter() {
   scenes = new ArrayMap<String, SpaceScene>();
   scenes.put("game", new SpaceGame(this));
   scenes.put("main menu", new MainMenu(this));
   scenes.put("training", new TrainingMenu(this));
 }
Exemple #8
0
 public void addSkillItem(SkillItem skill) {
   skill.setTower(this);
   skill.resetCooldown();
   mAllSkills.put(skill.getInfo(), skill);
   skill.getInfo().initTower(skill, this);
 }
  public BulletInfoManager() {
    mReader = new JsonReader();
    mLogics = new ArrayMap<Class<? extends AbstractLogic>, AbstractLogic>();

    mLoaders = new ArrayMap<String, AbstractLoader>();
    mLoaders.put("attack_damage", new AttackDamage());
    mLoaders.put("attack_distance", new AttackDistance());
    mLoaders.put("attack_time", new AttackTime());
    mLoaders.put("construction_time", new ConstructionTime());
    mLoaders.put("cost", new Cost());
    mLoaders.put("icon", new Icon());
    mLoaders.put("level_ups", new LevelUps());
    mLoaders.put("max_hp", new MaxHp());
    mLoaders.put("max_target_count", new MaxTargetCount());
    mLoaders.put("move_speed", new MoveSpeed());
    mLoaders.put("title", new Title());
    mLoaders.put("height", new Height());
  }