❔ is there a way for a method to have interchangeable parameter?
is there a way for a method to have interchangeable parameter depending on when I call it?
so I have this method
this method has a parameter of type Health_Boost and when I call it I do this
is there a way I can change the DrankHealthBoost(Health_Boost potion) parameter so I can do something like this
so have the parameter to be of type class shop
12 Replies
is there a way I can change the DrankHealthBoost(Health_Boost potion) parameter so I can do something like thisI dont get it
How can you drink a shop?
Jokes aside, yes, if what you want is for
HealthBoost
and Shop
to have some common behavior, then what you are looking for is interfaces.ill change the names to something more suitable because originally you could only increase your health by DRINKING a potion but now you can get it as a random drop
thought it was a dictionary but thx
Get the potion as a random drop?
yes like you go to the shop with money and then you get a random number depending on the number your given a random potion
Wouldn't it still be the same type you pass through then?
erm no because the purpose of the first parameter is to make the object the player interacted with go away
so either the shop or the health potion depending on how they get it
May be confusing naming then calling them both
potion
?yh will change that
at the end of the day, the player still drinks the potion. Don't know why you're trying to tie the player to drinking a shop
Yeah would have thought that should be dealt with separately
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.