I’m currently working on the Laser defender game and adding PowerUps.
Some background info:
In the enemy_behaviour script whenever enemy shoots I created a randomally Instatiator of the powerUp general prefab and it’s sprite onto the scene. In the player controller I check the name of the sprite and by that I can decide which powerUp was taken.
At first my whole code of the powerUps was in the player controller script and it actually worked great but was too messy. Now that I had split it into methods in the class of the PowerUp it is not working.
I’m adding the scripts of PowerUp class and player controller class.
I’ve added methods in the PowerUp class and called them from the player controller but I get errors.
First I tried to implement only the Quick powerUp.
Whenever I pick up the PowerUp of quick and it tries to start a Coroutine for the quick player(in the “CallQuicky” function in the PowerUp script)This error pops up: (I have added the Player prefab to the PowerUp script)
It drives me crazy because it worked when it was messy but in the same script - but now with the split in the scripts this error happens.
If you could take a look at the new scripts please and the previous ones maybe and explain why this is happening because nothing has changed really…
Thank you so much