I want to access a var named numOfBombs from the bucket actor. The reason for this is to use it in my bombSpawner actor for the speed up/slow down that he receives when the player gets a number of bombs (say 25) or when the player has less than said number.
Here is my (non-functional) sublimation of what it would look like in code:
Is this a good way to do it? Would it be better with else if?
I also have this:
inside the myWorld class. Could this help?
if (numOfBombs == 25)
{
bomberSpeed = bomberSpeed + 1;
}
if (numOfBombs == 50)
{
bomberSpeed = bomberSpeed + 2;
}
if (numOfBombs == 75)
{
bomberSpeed = bomberSpeed + 3;
}
if (numOfBombs == 100)
{
bomberSpeed = bomberSpeed + 4;
} private bucket playerBucket;
public bucket getABucket()
{
return playerBucket;
}
private bombSpawner theBomber;
public bombSpawner getABomber()
{
return theBomber;
}
