Hi, im making an educational game for a contest and i need some help.
As you already know, when the main char collides with the q Actor and when i press f, it will appear a new object named text1 which contains some text. The problem is that i don't know how to make it reappear when i press f again, i tried to move the boolean variable inside the method or make it true again after or before the f=false but it didnt work as expected. I made this boolean method because i tried to make it appear only once if i press a key and it worked, i you got any idea how to make it better im open for any ideas. Btw im a begginer and its my first time working on this program so dont take me too hard :D. Thanks!
public boolean f=false;
public void act(){
if(!f)
q11();
}
public boolean q11(){
Actor q=getOneIntersectingObject(q1.class);
if(q!=null){
if(Greenfoot.isKeyDown("f")){
f=false;
getWorld().addObject(new text1(),getX(),getY());}}
return f;
}
