having issues carrying variables to methods

i cant quite figure it out
19 Replies
Jamster3388
Jamster3388OP2y ago
so im making a simple rpg game and im trying to save the variables to a method that displays character info ((i know it needs refining id like to just get it working
Jamster3388
Jamster3388OP2y ago
Jamster3388
Jamster3388OP2y ago
thought id take a better screenshot
Down
Down2y ago
specify type of varriables you want to recieve
Jamster3388
Jamster3388OP2y ago
In the ()?
Down
Down2y ago
static void WriteSomething(string text) {
Console.WriteLine(text);
}
static void WriteSomething(string text) {
Console.WriteLine(text);
}
Jamster3388
Jamster3388OP2y ago
So if I’m calling a variable I have to do it with every static method?
Down
Down2y ago
how can you call a varriable you defined your methods inside Main method move them out and then call them inside Main
Jamster3388
Jamster3388OP2y ago
Ahhhhhh I get it now So you kinda enable those variables per method And specify it
Down
Down2y ago
kind of
Jamster3388
Jamster3388OP2y ago
So you can specifically define which variables per method
Down
Down2y ago
also if you want to use those properties
Down
Down2y ago
you need to make them static as well
Jamster3388
Jamster3388OP2y ago
So change them from public?
Down
Down2y ago
public is fine just add static public static float ...
Jamster3388
Jamster3388OP2y ago
Ah ok what will making it static do?
Down
Down2y ago
that you can use it in static methods and all your methods must be static if you want to call them inside Main since main must be static method complicated stuff
Jamster3388
Jamster3388OP2y ago
ah il figure it out lmao but yeah that fixed a lot of stuff and i learnt something very useful thanks!
Down
Down2y ago
np
Want results from more Discord servers?
Add your server