Android Open Source - Marble-Run Path






From Project

Back to project page Marble-Run.

License

The source code is released under:

Apache License

If you think the Android project Marble-Run 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 nttu.edu.entity;
/*from  ww w  .j a va 2s . co  m*/
public abstract class Path extends Entity {
  public static enum Orientation {
    //X axis to Y axis.
    HORIZONTAL, VERTICAL, LEFT_TO_UP, LEFT_TO_DOWN, RIGHT_TO_UP, RIGHT_TO_DOWN
  }
  
  public Orientation orientation;
  public final int PIPE_SIZE = 2;
  public float ratio;
  
  private float defaultX, defaultY, defaultZ;
  
  //Positions are marked from the top left corner (Since they are squares.)
  //Z axis is for height;
  public float[] position = new float[3];
  
  public void setOrientation(Orientation o) {
    this.orientation = o;
    switch (this.orientation) {
      case HORIZONTAL:
      default:
        srcRect.set(16, 8, 24, 16);
        break;
      case VERTICAL:
        srcRect.set(16, 0, 24, 8);
        break;
      case LEFT_TO_UP:
        srcRect.set(32, 8, 40, 16);
        break;
      case LEFT_TO_DOWN:
        srcRect.set(32, 0, 40, 8);
        break;
      case RIGHT_TO_UP:
        srcRect.set(24, 8, 32, 16);
        break;
      case RIGHT_TO_DOWN:
        srcRect.set(24, 0, 32, 8);
        break;
    }
  }
  
  public Orientation getOrientation() {
    return orientation;
  }
  
  public void setPlacement(float x, float y, float z) {
    // Z for above/below placements.
    //(x, y) is the center of a single pipe grid.
    position[0] = x;
    position[1] = y;
    position[2] = z;
    defaultX = x;
    defaultY = y;
    defaultZ = z;
    
  }
  
  public void setAspectRatio(float aspectRatio) {
    ratio = aspectRatio;
  }
  
  public abstract void place();
  
  @Override
  public void reset() {
    position[0] = defaultX;
    position[1] = defaultY;
    position[2] = defaultZ;
  }
}




Java Source Code List

nttu.edu.activities.LevelSelectionActivity.java
nttu.edu.activities.MenuActivity.java
nttu.edu.activities.NewLoadingActivity.java
nttu.edu.activities.PlayActivity.java
nttu.edu.activities.ScoreActivity.java
nttu.edu.activities.SettingsActivity.java
nttu.edu.alt.NewBall.java
nttu.edu.alt.NewCue.java
nttu.edu.alt.NewHole.java
nttu.edu.alt.Obstacle.java
nttu.edu.ball.Ball.java
nttu.edu.ball.Cue.java
nttu.edu.ball.Marble.java
nttu.edu.entity.Border.java
nttu.edu.entity.Bumper.java
nttu.edu.entity.Coin.java
nttu.edu.entity.Connector.java
nttu.edu.entity.CurvePipe.java
nttu.edu.entity.Entity.java
nttu.edu.entity.Funnel.java
nttu.edu.entity.Hole.java
nttu.edu.entity.Path.java
nttu.edu.entity.Pipe.java
nttu.edu.entity.Ramp.java
nttu.edu.entity.ShortFunnel.java
nttu.edu.entity.Tee.java
nttu.edu.entity.Terrain.java
nttu.edu.entity.Void.java
nttu.edu.graphics.Art.java
nttu.edu.graphics.RenderView.java
nttu.edu.handler.Accelero.java
nttu.edu.handler.ImageInfo.java
nttu.edu.handler.Info.java
nttu.edu.handler.Loading.java
nttu.edu.handler.ModPlayer.java
nttu.edu.handler.MusicHandler.java
nttu.edu.hud.BestScore.java
nttu.edu.hud.Compass.java
nttu.edu.hud.GoalCompass.java
nttu.edu.hud.HUDMenu.java
nttu.edu.hud.HUDScore.java
nttu.edu.hud.MarbleCompass.java
nttu.edu.hud.TimeBasedScore.java
nttu.edu.level.HUD.java
nttu.edu.level.Stage.java
nttu.edu.score.Format.java
nttu.edu.score.Score.java
nttu.edu.sound.Sound.java