C
C#11mo ago
Eren

My functions wont work and i dont know what i am doing wrong

i wonder what the issue is here i havve been looking for the last 2 hrs im so lost
No description
3 Replies
Eren
ErenOP11mo ago
context i need to be able to call these functions in this function but it wont work Resolving Moves Round Short description When the two trainers have chosen to have their Pokémon perform a move, it is based on: The speed determines which Pokémon can perform its move first. Implementation • Write a function based on the two trainers, their two Pokémon and two chosen indexes the moves, does not return anything but does print the execution of the moves to the console • When the speed of the first Pokémon is greater than or equal to that of the second Pokémon, then first the first Pokémon performs its move, then the second • If the speed of the first Pokémon is less than that of the second Pokémon, then First the second Pokémon performs its move, then the first • If in both cases, after the first execution of the move, the receiving Pokémon loses its lives (HealthPoints) would be set to 0, the function will be terminated prematurely • Update the battle information after each execution of a move • Also print the execution of all the moves to the console
Jimmacle
Jimmacle11mo ago
why are you making methods static?
jacobm2778
jacobm277811mo ago
Error CS0176 means you are trying to call the function by creating an object from a class instead of calling it from the class directly which is required for static. For example, when using statics you can't do something like MyClass object = new () then object.StaticFunction(), you have to do MyClass.StaticFunction. The other two errors probably just mean that the functions you are calling don't live in the file that is calling them. You should check imports/namespaces to fix this. To be more specific, if those functions are static as well you need to ensure you have those classes imported so that you may call them. Or if not, ensure imports are correct and create new object instances and call the function from those objects.
Want results from more Discord servers?
Add your server