Android Open Source - SpaceGame Clouds






From Project

Back to project page SpaceGame.

License

The source code is released under:

Copyright (c) 2012 ??ukasz Patalas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...

If you think the Android project SpaceGame listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lpatalas.spacegame;
/*  w ww  .  j a  v a 2 s.c o m*/
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

import java.util.ArrayList;
import java.util.List;

class Clouds {
  private final List<CloudLayer> layers = new ArrayList<CloudLayer>();

  public Clouds() {
    layers.add(new CloudLayer("images/cloud1.png", 0.34f, new Color(1, 0.5f, 0, 0.4f)));
    layers.add(new CloudLayer("images/cloud2.png", 0.1f, new Color(0, 0.0f, 0.5f, 0.4f)));
  }

  public void update(float deltaTime) {
    for (CloudLayer layer : layers) {
      layer.move(deltaTime);
    }
  }

  public void render(SpriteBatch spriteBatch) {
    setupBlending(spriteBatch);

    for (CloudLayer layer : layers) {
      layer.render(spriteBatch);
    }

    spriteBatch.setColor(1, 1, 1, 1);
  }

  private void setupBlending(SpriteBatch spriteBatch) {
    spriteBatch.enableBlending();
    spriteBatch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
}




Java Source Code List

com.lpatalas.spacegame.Assets.java
com.lpatalas.spacegame.Asteroid.java
com.lpatalas.spacegame.Asteroids.java
com.lpatalas.spacegame.CloudLayer.java
com.lpatalas.spacegame.Clouds.java
com.lpatalas.spacegame.DesktopStarter.java
com.lpatalas.spacegame.GameplayScreen.java
com.lpatalas.spacegame.MainMenuScreen.java
com.lpatalas.spacegame.Particles.java
com.lpatalas.spacegame.PlayerInputProcessor.java
com.lpatalas.spacegame.Player.java
com.lpatalas.spacegame.SpaceGameActivity.java
com.lpatalas.spacegame.SpaceGame.java
com.lpatalas.spacegame.Stars.java