Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] atualiza texto na tela andEngine

No método onAreaTouched, faça isso:
                switch (pSceneTouchEvent.getAction()) {
                     case TouchEvent.ACTION_UP:
                     //o que quer fazer ao tirar o dedo da tela
                   
                }

Agora em relação ao número maior que 9, se estiver usando um ChangeableText, ao criar o objeto você pode definir qual o tamanho máximo de caracteres.
Ex:
centerText = new ChangeableText(X, Y, Fonte, Texto, COLOCAR AQUI O TAMANHO);

Em 27 de fevereiro de 2013 15:04, Bruno Albuquerque <bruno.albuquerque@gmail.com> escreveu:
Sem você dizer qual é o erro, não tem muito como ser ajudado. Obviamente incrementar uma variável numerica qualquer pra um valor acima de 9 sempre vai funcionar e esse não é o problema. Qual o typo dessa variável countLek? E ela é um atributo de classe?

-Bruno

Em 27 de fevereiro de 2013 14:53, Felipe Cauê Legal Benedito <felipecaue.lb@gmail.com> escreveu:

Eu preciso incrementar o valor de uma variável, toda vez que clico em cima de um bicho.
Ela funciona até o nº 9 depois apresenta um erro e fecha o game.
Gostaria de prever também o momento de incrementar. Teria que ser toda vez que a pessoa tire o dedo da tela.

Esse é o código do bicho:

lek1 = new AnimatedSprite(230, 215, this.mLekTextureRegion, vertexBufferObjectManager) {
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
lek1.setVisible(false);
countLek+=1; <======== variável que é incrementada.
centerText.setText(String.valueOf(countLek));
mDelayTimeHandler1.reset();
return true;
}
};
lek1.setScaleCenterY(this.mLekTextureRegion.getHeight());
lek1.setScale(1.4f);
lek1.animate(new long[]{150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150}, 0, 14, true);
scene.attachChild(lek1);
scene.registerTouchArea(lek1);
scene.registerUpdateHandler(mDelayTimeHandler1);
mDelayTimeHandler1.setTimerCallbackTriggered(true);

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 




--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário