Android Open Source - SimpleGame Collision Screen






From Project

Back to project page SimpleGame.

License

The source code is released under:

GNU General Public License

If you think the Android project SimpleGame 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 ru.rs.screens;
//from www  .  j a v a2s  .  co m
import android.graphics.Color;
import ru.rs.GameWorld;
import ru.rs.gameobjects.SimpleGameWorld;
import ru.rs.interfaces.Game;
import ru.rs.interfaces.Graphics;
import ru.rs.interfaces.Input;
import ru.rs.interfaces.Input.TouchEvent;
import ru.rs.objects.Screen;

import java.util.List;

public class CollisionScreen extends Screen {

  private GameWorld gameWorld;
  private Input input;
  private Graphics graphics;

  private List<TouchEvent> touches;

  public CollisionScreen(Game g) {
    super(g);
    gameWorld = new SimpleGameWorld(game);
    input = game.getInput();
    graphics = game.getGraphics();
  }

  @Override
  public void update(float delta) {
    touches = input.getTouchEvents();
    if (touches.size() > 0) {
//      for (TouchEvent event : touches) {
//        if (event.x < 32 && event.y < 32) {
//          gameWorld.addAllyUnit();
//          gameWorld.addEnemyUnit();
//        }

            gameWorld.touch(touches);
//      }
    }
    gameWorld.update();

  }

  @Override
  public void render(float delta) {
    graphics.drawText(Float.toString(delta), graphics.getWidth() - 15, 15,
        Color.BLUE);
    graphics.clear(Color.BLACK);
    gameWorld.render();
  }

}




Java Source Code List

ru.rs.Resources.java
ru.rs.SimpleGame.java
ru.rs.gameobjects.Castle.java
ru.rs.gameobjects.DynamicObject.java
ru.rs.gameobjects.GeneralGrid.java
ru.rs.gameobjects.Side.java
ru.rs.gameobjects.SimpleGameWorld.java
ru.rs.gameobjects.SimpleObject.java
ru.rs.gameobjects.Unit.java
ru.rs.screens.CollisionScreen.java
ru.rs.screens.LoadingScreen.java
ru.rs.screens.MenuScreen.java