Jogo da bolinha J2ME

0 respostas
T

boa tarde galera.
bem... estou tentando fazer um jogo que é o seguinte. uma bolinha de emotion no meio da tela que a pessoa pode controlar e uma outra bola se movendo aleatoriamente.
se essa bola que se move bater na que eu controlo é game over.
só isso.
bem...como estou iniciando j2me só consegui ate agora por a bola no meio da tela.
preciso de orientação de como faze-la se movimentar e como criar outra bola que se movimente aleatoriamente pelo visor.

preciso da orientação de vocês !! :huh:

a já ia esqueçendo
isso foi oque fiz até agora:

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;


public class JogoMidlet extends MIDlet {
	

	public JogoMidlet() {
		// TODO Auto-generated constructor stub
	}

	protected void destroyApp(boolean unconditional)
			throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void startApp() throws MIDletStateChangeException {
		Display d = Display.getDisplay(this);
		JogoCanvas jogo = new JogoCanvas(true);
		Thread t = new Thread(jogo);
		d.setCurrent(jogo);
		t.start();
	}

}
import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;



public class JogoCanvas extends GameCanvas implements Runnable{

	protected JogoCanvas(boolean suppressKeyEvents) {
		super(suppressKeyEvents);
		// TODO Auto-generated constructor stub
	}
	
	 public void run(){
		 Graphics g = null;
		 Image emotion = null;
		 try {
			emotion = Image.createImage("/emotion.png");
			g = getGraphics();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		while(true){
			g.drawImage(emotion, getWidth()/3, getHeight()/2, Graphics.TOP | Graphics.HCENTER);
			flushGraphics();
			
			try {
				Thread.sleep(500);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
	 }
	
}
Criado 12 de dezembro de 2010
Respostas 0
Participantes 1