Android Open Source - Replica-Jump Level1






From Project

Back to project page Replica-Jump.

License

The source code is released under:

GNU General Public License

If you think the Android project Replica-Jump 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.vinicius.dsl.replicajump.level;
// w  w w .  j  ava2s. co m
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class Level1 {
    private int count=0;
  private String JSON_LEVEL = "[" +
      "{\"posX\":\"100\",\"posY\":\"250\",\"type\":\"1\"}," +
      "{\"posX\":\"200\",\"posY\":\"200\",\"type\":\"2\"},"+
      "{\"posX\":\"300\",\"posY\":\"300\",\"type\":\"5\"},"+
      "{\"posX\":\"400\",\"posY\":\"400\",\"type\":\"6\"},"+
      "{\"posX\":\"500\",\"posY\":\"100\",\"type\":\"5\"},"+
      "{\"posX\":\"600\",\"posY\":\"200\",\"type\":\"6\"},"+
      "{\"posX\":\"700\",\"posY\":\"300\",\"type\":\"5\"},"+
      "{\"posX\":\"800\",\"posY\":\"400\",\"type\":\"6\"},"+
      "{\"posX\":\"900\",\"posY\":\"200\",\"type\":\"3\"},"+
      "{\"posX\":\"1100\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"1200\",\"posY\":\"400\",\"type\":\"2\"},"+
      "{\"posX\":\"1300\",\"posY\":\"100\",\"type\":\"3\"},"+
      "{\"posX\":\"1400\",\"posY\":\"200\",\"type\":\"4\"},"+
      "{\"posX\":\"1500\",\"posY\":\"300\",\"type\":\"5\"},"+
      "{\"posX\":\"1600\",\"posY\":\"400\",\"type\":\"6\"},"+
      "{\"posX\":\"1700\",\"posY\":\"100\",\"type\":\"1\"},"+
      "{\"posX\":\"1800\",\"posY\":\"200\",\"type\":\"2\"},"+
      "{\"posX\":\"1900\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"2000\",\"posY\":\"400\",\"type\":\"3\"},"+
      "{\"posX\":\"2100\",\"posY\":\"100\",\"type\":\"4\"},"+
      "{\"posX\":\"2200\",\"posY\":\"200\",\"type\":\"5\"},"+
      "{\"posX\":\"2300\",\"posY\":\"300\",\"type\":\"6\"},"+
      "{\"posX\":\"2400\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"2500\",\"posY\":\"50\",\"type\":\"2\"},"+      
      "{\"posX\":\"2600\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"2700\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"2800\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"2900\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"3000\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"3100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"3200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"3300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"3400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"3500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"3600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"3700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"3800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"3900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"4000\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"4100\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"4200\",\"posY\":\"400\",\"type\":\"2\"},"+
      "{\"posX\":\"4300\",\"posY\":\"100\",\"type\":\"3\"},"+
      "{\"posX\":\"4400\",\"posY\":\"200\",\"type\":\"4\"},"+
      "{\"posX\":\"4500\",\"posY\":\"300\",\"type\":\"5\"},"+
      "{\"posX\":\"4600\",\"posY\":\"400\",\"type\":\"6\"},"+
      "{\"posX\":\"4700\",\"posY\":\"100\",\"type\":\"1\"},"+
      "{\"posX\":\"4800\",\"posY\":\"200\",\"type\":\"2\"},"+
      "{\"posX\":\"4900\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"5000\",\"posY\":\"400\",\"type\":\"3\"},"+
      "{\"posX\":\"5100\",\"posY\":\"100\",\"type\":\"4\"},"+
      "{\"posX\":\"5200\",\"posY\":\"200\",\"type\":\"5\"},"+
      "{\"posX\":\"5300\",\"posY\":\"300\",\"type\":\"6\"},"+
      "{\"posX\":\"5400\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"5500\",\"posY\":\"50\",\"type\":\"2\"},"+      
      "{\"posX\":\"5600\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"5700\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"5800\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"5900\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"6000\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"6100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"6200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"6300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"6400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"6500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"6600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"6700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"6800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"6900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"7000\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"7100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"7200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"7300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"7400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"7500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"7600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"7700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"7800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"7900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"8000\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"8100\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"8200\",\"posY\":\"400\",\"type\":\"2\"},"+
      "{\"posX\":\"8300\",\"posY\":\"100\",\"type\":\"3\"},"+
      "{\"posX\":\"8400\",\"posY\":\"200\",\"type\":\"4\"},"+
      "{\"posX\":\"8500\",\"posY\":\"300\",\"type\":\"5\"},"+
      "{\"posX\":\"8600\",\"posY\":\"400\",\"type\":\"6\"},"+
      "{\"posX\":\"8700\",\"posY\":\"100\",\"type\":\"1\"},"+
      "{\"posX\":\"8800\",\"posY\":\"200\",\"type\":\"2\"},"+
      "{\"posX\":\"8900\",\"posY\":\"300\",\"type\":\"1\"},"+
      "{\"posX\":\"9000\",\"posY\":\"400\",\"type\":\"3\"},"+
      "{\"posX\":\"9100\",\"posY\":\"100\",\"type\":\"4\"},"+
      "{\"posX\":\"9200\",\"posY\":\"200\",\"type\":\"5\"},"+
      "{\"posX\":\"9300\",\"posY\":\"300\",\"type\":\"6\"},"+
      "{\"posX\":\"9400\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"9500\",\"posY\":\"50\",\"type\":\"2\"},"+      
      "{\"posX\":\"9600\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"9700\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"9800\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"9900\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"10000\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"10100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"10200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"10300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"10400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"10500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"10600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"10700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"10800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"10900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"11000\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"11100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"11200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"11300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"11400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"11500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"11600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"11700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"11800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"11900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"12000\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"12100\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"12200\",\"posY\":\"400\",\"type\":\"1\"},"+
      "{\"posX\":\"12300\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"12400\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"12500\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"12600\",\"posY\":\"400\",\"type\":\"1\"},"+      
      "{\"posX\":\"12700\",\"posY\":\"50\",\"type\":\"2\"},"+
      "{\"posX\":\"12800\",\"posY\":\"200\",\"type\":\"1\"},"+
      "{\"posX\":\"12900\",\"posY\":\"300\",\"type\":\"2\"},"+
      "{\"posX\":\"13000\",\"posY\":\"400\",\"type\":\"1\"},"+
      "]";
  private JSONArray level_items;
  public Level1(int level_id){
    try {
      level_items = new JSONArray(JSON_LEVEL);
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  
  public  LevelObject getNext(){
    
    if(count<level_items.length()){
    JSONObject item = null;
        try {
        item = level_items.getJSONObject(count);
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        item=null;
      }
        if(item!=null){
    LevelObject object=null;
    try {
      Log.d("object", item.toString());
      object = new LevelObject(Float.parseFloat(item.getString("posX")),Float.parseFloat( item.getString("posY")), Integer.parseInt(item.getString("type")));
    } catch (NumberFormatException e) {
      // TODO Auto-generated catch block
      object = null;
      e.printStackTrace();
    } catch (JSONException e) {
      // TODO Auto-generated catch block
      object = null;
      e.printStackTrace();
    }
        count++;
    return object;
        }else{
          return null;
        }
    }else{
      return null;
    }
  }
}




Java Source Code List

com.vinicius.dsl.replicajump.CustomCamera.java
com.vinicius.dsl.replicajump.ReplicaJumpActivity.java
com.vinicius.dsl.replicajump.level.Level1.java
com.vinicius.dsl.replicajump.level.LevelObject.java
com.vinicius.dsl.replicajump.manager.GameManager.java
com.vinicius.dsl.replicajump.manager.ResourceManager.java
com.vinicius.dsl.replicajump.manager.SceneManager.java
com.vinicius.dsl.replicajump.scene.LevelScene.java
com.vinicius.dsl.replicajump.scene.MainMenuScene.java
com.vinicius.dsl.replicajump.sprite.AndroidSprite.java
com.vinicius.dsl.replicajump.sprite.CoinGreen.java
com.vinicius.dsl.replicajump.sprite.CoinYellow.java
com.vinicius.dsl.replicajump.sprite.Enemy1.java
com.vinicius.dsl.replicajump.sprite.Enemy2.java
com.vinicius.dsl.replicajump.sprite.Enemy3.java
com.vinicius.dsl.replicajump.sprite.EnemyLarge.java
com.vinicius.dsl.replicajump.util.BasicScene.java
com.vinicius.dsl.replicajump.util.Constants.java
com.vinicius.dsl.replicajump.util.Preferences.java