Android Open Source - thread-android World






From Project

Back to project page thread-android.

License

The source code is released under:

Copyright (c) 2012 Chris Gauthier, http://www.wordsaretoys.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "S...

If you think the Android project thread-android 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.wordsaretoys.thread;
/*from  www .  j  av  a2 s.c o m*/
import com.wordsaretoys.soar.Line;
import com.wordsaretoys.soar.Pattern;
import com.wordsaretoys.soar.Surface;

public class World {

  private Line line;
  
  private Surface surf0;
  private Surface surf1;
  private Surface surf2;
  
  public World() {
    // create road height object
    line = new Line(128, 6, 0.05);
    Pattern.randomize(line, 0, 0, 1);

    // create cliff surface objects
    surf0 = new Surface(32, 32, 10, 0.2, 0.4);
    Pattern.walk(surf0, 0, 8, 0.05, 1, 0.5, 0.5, 0.5, 0.5);
    Pattern.normalize(surf0, 0, 1);
    
    surf1 = new Surface(64, 64, 5, 0.5, 1.0);
    Pattern.walk(surf1, 0, 8, 0.05, 1, 0.5, 0.5, 0.5, 0.5);
    Pattern.normalize(surf0, 0, 1);

    surf2 = new Surface(128, 127, 1, 0.75, 1.5);
    Pattern.walk(surf2, 0, 8, 0.05, 1, 0.5, 0.5, 0.5, 0.5);
    Pattern.normalize(surf0, 0, 1);
  }
  
  /**
   * returns road height
   * @param z player z-position
   * @return height of road at z
   */
  public double roadHeight(double z) {
    return line.get(z);
  }

  /**
   * returns cliff surface
   * @param y, z player y, z position
   * @return cliff x position
   */
  public double cliffSurface(double y, double z) {
    return surf0.get(y, z) + surf1.get(y, z) + surf2.get(y, z);
  }

}




Java Source Code List

com.wordsaretoys.thread.Brush.java
com.wordsaretoys.thread.Cliff.java
com.wordsaretoys.thread.Hud.java
com.wordsaretoys.thread.Main.java
com.wordsaretoys.thread.Path.java
com.wordsaretoys.thread.Player.java
com.wordsaretoys.thread.Road.java
com.wordsaretoys.thread.Rocks.java
com.wordsaretoys.thread.Textures.java
com.wordsaretoys.thread.World.java