Need help with pokemon game for school
i only have 2 days left been working on this stuff but its so much and very hard can someone help me
147 Replies
You've made several thread and in all of them you fail to provide any details unless asked.
I'd have hoped you would have learned to include details in the opening post instead of us having to drag it out of you
So if you truly want help, you'll have to give more details about where you are stuck and what you need help with.
Posting a thread and then going to play fortnite isn't really going to finish your assignment on its own 🙂
It's a continuation from #calling functions I guess?
ill give more details my bad
this is what i need to make
i have gotten to phase 3.1
i dont have to skill to get to 4.20 in 1 day and a half
why are u being rude im not on the game its open in the background
if u got nothing good to say dont reply
no i solved that because of u so thank you for that
You made a thread then disappeared for exactly one hour.
was just wondering if anyone could help me with that
i was coding my 3.1 function
i solved that issue i had with it
as u can see it took me a whole hour because im still a newbie
so i made this thread to see if anyone could help speed this up cuz i only have 2 days left
Do you not see how its very rude to make a help post, provide zero details and not even reply to follow up questions?
i replied
gave the file
After an hour.
a full hour after getting questions.
questions that were asked 4 minutes after you posted the thread.
i was solving something with the help of someone
so i ask for help
forget to check which is my bad
and ur just gonna sit here n argue with me
thats not gonna help any of us
i dont have time to argue over bullshiot
shit
either help or go argue somewhere else
Well you have yet to actually say what you need help with
i need help with
Other than posting the entire PDF
making the functions
so basically
What have you tried? Where are you stuck?
theres like 25 + functions i still have to make
and im stuck at the 3.2 function which involves making the item selection
i sent the file because it shows all of it
Short description
During the battle, the trainers must be able to use items.
Implementation
• Create a function that, based on a trainer, returns the index of the selected item
• First the user is asked which item he or she wants to use
"Trainer {trainer.Name}, what item would you like to use?"
• Then print the item battle information from the trainer to the console
• If the user does not enter a valid item index, throw an exception and catch it
• Continue asking the user for a valid item index as long as they have not provided one
this is what i need to do for the function
And what have you tried?
You need to post your code
wait so if i need help with something i havent made yet
u cant help?
How can you know you need help if you havn't even started?
how can you be stuck before even trying?
i need help
cuz i dont have enough time
and dont understand everything well enough
thats my issue
i been working on this for so long aswell
Define exactly what kind of help you are looking for
putting so many hours into just this project
someone who could help me get past the last 2 phases and help if i ask them a question when im trying
so i dont get stuck on one part for 2-3 hrs
like i did earlier
ask them a question when im tryingthats what you can use this thread for, no? I'm here. If you ask a question, I can answer it.
yeahi got a question cuz im stuck on one part atm
idk if u mind reading this real quick
Short description
During the battle, the trainers must be able to choose between their Pokémon moves
perform or use items yourself.
Implementation
• Create a function that, based on a trainer and a Pokémon, is the index of the chosen action
gives back
• First the user is asked what action he or she wants to perform
"Trainer {trainer.Name}, what would you like to do?"
"1) Do Move"
"2) Use Item"
• If the user does not enter a valid action index, throw an exception and catch it
on
• When the user enters action index 1 and all the moves of the Pokémon are the number
times it can be executed equals 0, throw an exception, and catch it too
• When the user enters action index 2 and the number of trainer items is 0, discard
an exception and catch it
• Keep asking the user for a valid action index as long as he or she has not provided one
this is what i need to make next
and i am stuck on the part of what i need to return
Well you have something like a game loop, that runs until one player wins right?
something like this
yeah but thats later
i dont have that yet
okay.
because
• Create a function that, based on a trainer and a Pokémon, is the index of the chosen action gives backseems to be specifically about the player ordering their pokemon to do a move thats not relevant if the player instead picked to use an item
right so ill have to give in the trainer and pokemon then?
and return the index
?
the function responsible for getting a pokemon move, sure
but...
During the battle, the trainers must be able to choose between their Pokémon moves perform or use items yourself.this text conflicts with that you need to know if the player wants to do a move or if they want to use an item first
yes
but i think they will show me what the order is
thats also in the later functions
rn its mostly creating the fucntions to select them
to be able to
but 3.1 and 3.2 are those parts
cuz rn i cant pick any actions
3.3 is the "do a move OR use an item" function
yes which r done but for the action
yes true
so i would need to use a if else assuming it asks for item or move
well you need to ask the user what they want to do and get the answer, then use either 3.1 or 3.2 to handle the choice
yeah okay makes sense
this is what ive got so far
Okay
am i supposed to use one of the old functions in this one?
maybe later, but not yet
alright
you first need to know what the user wants to do
i gave it input aswell
you've printed instructions so far
so i added a string input = Console.Readline()
okay
now it says i need a exception
would a try catch me block be usefull here or should i leave that out?
well, you need to check what the user wrote
if its out of the index bounds
it will be invalid
so the amount of moves/items u can select
sure, or if I wrote "cheesecake"
thats not a valid choice in this setting
yeah for stuff like that
alright
what would be valid
cmon
maybe a if statment?
statement
you could indeed solve this with
if
something like this ?
no
you just want to know if they picked 1, or 2, or something else
so if index = 1
return index
else throw new exception
?
well, thats not how I imagine it
like, I don't think you should follow the first instruction here, since it seems at odds with the intent of the function
it says to return the selected pokemon move index, but that makes no sense if the user selects to use an item
oooh
"action", not "move"
yeah, it just wants 1 or 2
yeah
thats silly, but okay
so does this make sense
i know but i gotta bear with it
almost
the core idea is there, but you need a few adjustments
still need to return something
right
as in the numbers maybe are wrong ?
or the code
• Keep asking the user for a valid action index as long as he or she has not provided oneso if the index wasnt 1 or 2, just keep going well what needs adjustment is the check for valid pokemon moves
so that console.writeline at the bottom
needs to have something with it
that needs to go inside the while loop
done
actually, can you copypaste this entire function here?
is that all or is there more logic missing behind the cw ?
preferably in a $code block
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/$codegif
yes
sorry was figuring out how to make it enter
so, to increase readability here I'd probably suggest you "invert" your ifs
instead of checking if the value was valid, check for invalid
so i would have to change the values correct?
consider this snippet
hmm
so thats basically more readable and shorter
I sure think so
and does the same thing
yup.
are u okay with me using that yes?
yes.
would i still have to use the code
where it says
item is unavailable
and move is unavailble
or do i scrap that too?
no you need those, according to the instructions
can i send u the code and show u if theres more adjustments needed
something aint right here
two index loops?
i forgot to delete that
removed it now sorry
also you don't handle
index == 1
hereso while index = 1
then it does the part u send
then else if index = 2
nah the part I sent is there to stop "cheesecake"
it just handles the cases where the user entered a non-number
you still need to check that the number was valid
and do the right checks before returning the index
right
so ill still need to add the part of the unavailble items / moves
well you had it for items
btw, your trainers list of items
is it really called
Item
?
shouldn't it be Items
?they told me to call it item
so idk i just do whats given
Een Trainer heeft: • Een naam • Een lijst van pokémon • Een lijst van items
its just so hard to do when they send u a random file and tell u to do what they want
yes it has a list of items in the class
that states the prop should be called
Items
oh
i wrote it wrong then
visual studio can rename it for you
just click it and do refactor->rename
and it will rename it everywhere
i just dit it manually everywhere hhaha
didnt know that but thank u for finding that
now back to the fucntion
all i have is the part u send me
i removed my bit cuz it confused me
so now i need to make the part where it gives me the statement when a move or item is not available right?
well, after my snippet you know the user input was a number
and that
index
now holds that number
but thats all we know
but I think you can fix the rest of the method from here, based on what you've previously shownso all i need now is to throw the exception
I don't know, I can't see your code
when its got no more uses left?
but if all you have is my snippet, then... no?
yeah thats all i have at th moment
it got confusing when i mixed it
think about it logically
i need the exception
// we now know input was a number, and index has the value
and to make it ask for the correct input
until it gets given the right inpput
well you kinda already have that
a else statment
throwing a exception
and saying that it is unavailable/
?
you shouldn't need
else
at all in this code tbhso just use ifs then?
imho, yes
but honestly, dont worry about it
use else if you want
idk man im not that good at this stuff so i dont wanna not listen to you yk but
in fact, if you follow my every suggestion Im pretty sure your teacher will be able to tell you've had a lot of outside help 😛
see, when I write a method like this
no teacher is helping
I do it the way I write production code.
we have been given this in a file
they didnt explain nothing
its just a file sent to use to make
and we just started seeing about the classes and stuff they kinda just gave us the whole pack after 2 weeks of lessons about classes
read what I wrote again.
Im saying that my code style is different from yours
visibly so
meaning when your teacher reads the code to grade it or whatever, they will see how different this method is from the rest
yeah thats why ill just use the else statement
now back to the function cuw i stilll havent found it
i need to use a else if here or a if right
and then check if there is more then 0 uses
something like that ye
so if move count = 0
cw
No moves available
?
idk im so confused idek what it is
what is confusing here?
you've more or less written the correct code like 3 times over now
HAHHA have i
??
whats the part i need to still insert then of what ive wrote
well, with one or two minor things missing in each iteration 😄
show me what you have right now
alright
with a creenshot
or the code this
?
code here is almost always better
unless you are trying to show an error
alright understood ill just do that from now on
cs
that.. uh..
you'll return 1 here regardless if the user has available moves or not
and you are not handling the case of index == 2 at all
also, your
return index
thing will make it so any number can be returned
since your while loop only checks for == 0
I'd recommend you remove the number validation from the while loop tbh
if the value is 1, check if there are any moves available, return 1
if the value is 2, check if items are available, return 2
if anything else, print "invalid choice" and restart the loop
remember: an exception or a return statement immediately stops the execution of a methodalright let me try it
so delete the return index
then it gives me a error
yeah, because of your while loop
if you fix that too, it won't
your method MUST have a return value. One way of doing that is to never let the execution leave the while loop until it returns a valid value or throws an exception
sorry had dinner im back
i still havent found it man
¯\_(ツ)_/¯
I get the feeling you are not familiar enough with the individual parts to be able to assemble them into the correct structure
you correctly identified that you needed a while loop, console input, parsing, checking numbers, returning values, throwing exceptions etc
so unless you've been chatgpting the code the entire time, you should be a few minutes away from this being done
im not
using chat
good
because i have to explain this so if i use it
i will be standing there with no idea whats going on
sure
well, without giving you the answer directly Im not sure how much more I can do
You have all the parts
you just need to assemble them
I'll give you one more hint:
while(true)
is better than while(index == 0)
here.alright let me have a look properly and see what i can do
been making this for so long taking me so much time
probably why im so confused rn cuz ive been sat here for more then a week doing this
bashing your head against a wall for a week is not a good idea, as you've noticed 😛
once you stop making progress, its best to ask for help asap
yeah i genuinely been losing it
i know its part of it
but this is alot for me personally
i didnt solve it yet btw but im jsut gonna make the ones i understand already
cuz me sitting there waiting isnt bringing me forward
What must you do if the user chose to do a pokemon move?
What must you do if the user chose to use an item?
-1
i solved it btw
ty for the help