Android Open Source - Infinite World






From Project

Back to project page Infinite.

License

The source code is released under:

GNU General Public License

If you think the Android project Infinite 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.detel.infinite.models;
//  w  w  w .j  av  a  2s .  c  o m
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Vector2;

import java.util.ArrayList;

/**
 * Created by Derick on 2/21/14.
 */
public class World {

    private ArrayList<Chunk> chunks;
    private ArrayList<Enemy> enemies;
    private ArrayList<ThrowingKnife> throwingKnives;

    private Player player;
    private final static int PLAYER_SPAWN_X = 50;
    private final static int PLAYER_SPAWN_Y = 3;

    private OrthographicCamera camera;
    private final static Vector2 VIEWPORT = new Vector2(20,12);

    private int overallScore;
    private int bonusScore;

    public World(){
        chunks = new ArrayList<>();
        enemies = new ArrayList<>();
        throwingKnives = new ArrayList<>();

        player = new Player(PLAYER_SPAWN_X,PLAYER_SPAWN_Y);
        camera = new OrthographicCamera();
    }

    public void addChunks(Chunk chunk){
        chunks.add(chunk);
    }

    public void addEnemy(Enemy enemy){
        enemies.add(enemy);
    }

    public void addThrowingKnife(ThrowingKnife throwingKnife) {
        throwingKnives.add(throwingKnife);
    }

    public void addBonusScore(int points){
        bonusScore += points;
    }

    public ArrayList<Chunk> getChunks(){
        return chunks;
    }

    public ArrayList<Enemy> getEnemies(){
        return enemies;
    }

    public ArrayList<ThrowingKnife> getThrowingKnives() {
        return throwingKnives;
    }

    public Player getPlayer(){
        return player;
    }

    public OrthographicCamera getCamera(){
        return camera;
    }

    public Vector2 getViewport(){
        return VIEWPORT;
    }

    public int getScore(){
        overallScore = bonusScore + (int)player.getPosition().x;
        return overallScore;
    }

}




Java Source Code List

com.detel.infinite.Infinite.java
com.detel.infinite.MainActivity.java
com.detel.infinite.Main.java
com.detel.infinite.controllers.CameraController.java
com.detel.infinite.controllers.ChunkController.java
com.detel.infinite.controllers.EnemyController.java
com.detel.infinite.controllers.KnifeController.java
com.detel.infinite.controllers.PlayerController.java
com.detel.infinite.controllers.WorldController.java
com.detel.infinite.models.BlockAir.java
com.detel.infinite.models.Block.java
com.detel.infinite.models.Chunk.java
com.detel.infinite.models.Enemy.java
com.detel.infinite.models.Player.java
com.detel.infinite.models.ThrowingKnife.java
com.detel.infinite.models.World.java
com.detel.infinite.screens.ScreenBase.java
com.detel.infinite.screens.ScreenGameOver.java
com.detel.infinite.screens.ScreenGame.java
com.detel.infinite.screens.ScreenMainMenu.java
com.detel.infinite.screens.ScreenPause.java
com.detel.infinite.views.WorldRenderer.java