Package azis

Source Code of azis.SceneTest

package azis;

import java.awt.Color;
import java.awt.Graphics2D;

import main.scenario.Scene;

import age.GameController;
import age.Keyboard;
import main.Player;

/**
* Teste simples do cen�rio da primeira fase. Verifica se todos os objetos s�o desenhados corretamente
* e se o jogador interage corretamente com eles (por exemplo, cai sem atravessar o ch�o, mas pode
* cair nos rios de lava).
* @author Azis
*
*/
public class SceneTest implements GameController {

  public static void main(String[] args){
    TestLoader.testGameController(new SceneTest(), 5);
  }
 
  Player p;
  Scene scene;
 
  @Override
  public void load() {
    scene = new Scene();
    p = new Player(10, 0, 50, 100){
      @Override
      public void render(Graphics2D g){
        g.setColor(Color.white);
        g.fillRect(x, y, width, height);
        g.drawString("<-- Player", x + 50, y + 20);
      }
    };
  }

  @Override
  public void render(Graphics2D g) {
    scene.render(g);
    p.render(g);
  }

  @Override
  public void start() {

  }

  @Override
  public void unload() {

  }

  @Override
  public void update() {
    scene.update();
    p.update();
    if(scene.canFall(p, 1))
      p.y++;
    //faz o jogador "pular"
    if(Keyboard.keyPressed(Keyboard.VK_CONTROL))
      p.y = 300;
  }

}
TOP

Related Classes of azis.SceneTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.