Hi!
I tried (like 5 hours) for change the image of an object.
Like the code, I want to change the images of that object like a RPG dialog. When the user press "enter" the image change for the next.
But the problem is when I press "enter" it only disappear, is like "jump" to the "seccion == 2" when I deleted the objects of dialog.
Any suggestions? or help?
Thanks!
String keyPressed = Greenfoot.getKey();
if ("enter".equals(keyPressed))
{
if (seccion == 0){
((Episodio1_1)getWorld()).text.setImage("ep_1_diag/kaz_2.PNG");
seccion++;
}
if (seccion == 1){
Greenfoot.playSound("sfx/monster.mp3");
((Episodio1_1)getWorld()).text.setImage("ep_1_diag/kaz_3.PNG");
seccion++;
}
if (seccion == 2){
((Episodio1_1)getWorld()).text.setImage("ep_1_diag/kaz_4.PNG");
((Episodio1_1)getWorld()).borrarDialogo();
}
}
