i got a konami code for my game as an Easter egg an if you type it correct an int increases by 1 or a boolean gets set to true its not important if its a boolean or int for me
but now i want to use the int/boolean in another actor so when you typed the konami code the weachter is no longer able to (kill = toeten) the abenteurer but rCount is not a declared variable in the actor weachter
so how can i access a Boolean/int From Another Actor Class
public void Toeten()
{
if(rCount == false or rCount == 0){
if ((isTouching(Abenteurer.class)))
{
GameEnd myImage = new GameEnd ();
World w = getWorld();
w.addObject(myImage, 9, 9);
myImage.setImage("WG.png");
Greenfoot.stop();
}
}
}
private static final String[] konamiKeys = { "up", "up", "down", "down", "left", "right", "left", "right", "b", "a", "enter" }; private int keyIndex = 0; public void konami() { String key = Greenfoot.getKey(); if (key != null) { if (konamiKeys[keyIndex].equals(key)) // is next key in sequence { if (++keyIndex == konamiKeys.length) // is last key in sequence { //rCount = true; //rCount = 1; keyIndex = 0; } } else // not in sequence -- start over { keyIndex = 0; } } } private int pngCount = 0 ; //public int rCount = 0; //public boolean rCount = false; public void delayCounting() { pngCount++; if(pngCount == 14) { pngCount = 0; } } void Rainbow() { if(rCount == true or rCount == 1){ if(pngCount == 2) { setImage("ACO.png"); } if(pngCount == 4){ setImage("ACY.png"); } if(pngCount == 6){ setImage("ACG.png"); } if(pngCount == 8){ setImage("ACLB.png"); } if(pngCount == 10){ setImage("ACB.png"); } if(pngCount == 12){ setImage("ACP.png"); } if(pngCount == 14){ setImage("abenteurer.png"); } if ((isTouching(Waechter.class))) { GameEnd myImage = new GameEnd (); World w = getWorld(); w.addObject(myImage, 9, 9); myImage.setImage("GG.png"); Greenfoot.stop(); } } } }