Games Java Mobile

Java

27/05/2009

Estou tentando modificar um template que tem no NetBeans
onde o Sprite KAREL tem de pegar a aranha (SPRITE THOMAS)

Gostaria de saber qual o comando eu insiro no codigo para quando o Karel colidir com Thomas
o jogo carregar outra cena ou finalizar.

o codigo contido na parte a ser inserida é este

/**
* Check if sprite collides with either the other sprite or
* with a layer that holds obstacles or with the edge of the base layer.
*
* @param sprite the sprite checked for collision with other layers
* @return true is sprite does collide, false otherwise
*/
public boolean spriteCollides(Sprite sprite) {
return sprite.collidesWith(
sprite == this.spriteKarel ? this.spriteThomas : this.spriteKarel, true)
|| sprite.collidesWith(this.tlThings, true)
|| sprite.collidesWith(this.tlTrees, true)
|| sprite.collidesWith(this.tlWater, true)
|| sprite.getX() < 0 || sprite.getY() < 0
|| sprite.getX() > (this.tlBase.getWidth() - sprite.getWidth())
|| sprite.getY() > (this.tlBase.getHeight() - sprite.getHeight()
);
}



alguem pode me ajudar???

Vlw


Otavio Santos

Otavio Santos

Curtidas 0
POSTAR