Android Open Source - Terry-Coin Game






From Project

Back to project page Terry-Coin.

License

The source code is released under:

Apache License

If you think the Android project Terry-Coin 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.tcg.terry.main;
//  www . j a  va2s  . co m
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.tcg.terry.managers.Content;
import com.tcg.terry.managers.GameStateManager;

public class Game implements ApplicationListener {
  public static int WIDTH;
  public static int HEIGHT;
  public static boolean debug;
  public static void setDebug(boolean debug) {
    Game.debug = debug;
  }

  public static FileHandle fontFile;
  public static FileHandle fontImage;
  
  public static OrthographicCamera cam;
  
  private GameStateManager gsm;
  
  public static Content res;
  
  @Override
  public void create() {    
    debug = false;
    WIDTH = Gdx.graphics.getWidth();
    HEIGHT = Gdx.graphics.getHeight();
    fontFile = Gdx.files.internal("Fonts/text.fnt");
    fontImage = Gdx.files.internal("Fonts/text.png");
    
    Texture.setEnforcePotImages(false);
    
    cam = new OrthographicCamera(WIDTH, HEIGHT);
    cam.translate(WIDTH / 2, HEIGHT / 2);
    cam.update();

    res = new Content();
    res.loadMusic(Gdx.files.internal("sound/Field1.ogg"), "bgm");
    res.loadMusic(Gdx.files.internal("sound/Theme1.ogg"), "title");
    res.loadMusic(Gdx.files.internal("sound/Applause2.ogg"), "go");
    res.loadMusic(Gdx.files.internal("sound/Fanfare3.ogg"), "splash");
    res.loadMusic(Gdx.files.internal("sound/Gameover1.ogg"), "gos");
    res.loadMusic(Gdx.files.internal("sound/Scene6.ogg"), "controls");
    res.loadSound("sound/Coin.ogg", "coin");
    res.loadSound("sound/Jump1.ogg", "jump");
    
    gsm = new GameStateManager();
  }
  @Override
  public void render() {    
    
    //makes screen black
    Gdx.gl.glClearColor(0, 1, 1, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    
    gsm.update(Gdx.graphics.getDeltaTime());
    gsm.draw();
    
    Gdx.graphics.setTitle("Terry's Coin Collector | " + Gdx.graphics.getFramesPerSecond() + " FPS" );
  }

  @Override
  public void dispose() {
    res.removeAll();
  }

  @Override
  public void resize(int width, int height) {}

  @Override
  public void pause() {}

  @Override
  public void resume() {}
}




Java Source Code List

com.tcg.terry.MainActivity.java
com.tcg.terry.Main.java
com.tcg.terry.entities.Button.java
com.tcg.terry.entities.Cloud.java
com.tcg.terry.entities.Coin.java
com.tcg.terry.entities.Cursor.java
com.tcg.terry.entities.Flower.java
com.tcg.terry.entities.Ground.java
com.tcg.terry.entities.JumpButton.java
com.tcg.terry.entities.MenuButton.java
com.tcg.terry.entities.Player.java
com.tcg.terry.entities.SprintButton.java
com.tcg.terry.gamestates.ControlsState.java
com.tcg.terry.gamestates.GameOverState.java
com.tcg.terry.gamestates.GameState.java
com.tcg.terry.gamestates.MenuState.java
com.tcg.terry.gamestates.PlayState.java
com.tcg.terry.gamestates.SplashState.java
com.tcg.terry.main.Game.java
com.tcg.terry.managers.Content.java
com.tcg.terry.managers.GameStateManager.java
com.tcg.terry.managers.Timer.java