Good day!
Firstly, I kindly thank you for spending your time on reading this.
I am complete beginner in HTML/CSS/JS, I only started it 2 months ago. Currently I’m on JS ES6 section of FCC curriculum.
I want to make a very simple text-based RPG game using JavaScript (allowing multiple players on one PC, maybe in future extend it to run it on local server).
Main goal will be to defeat monsters and gradually level up to gain better statistics and gain gold for better equipment in order to defeat final boss.
I just started working on my design.
- First goal is to implement multiple player creation.
Problems I encountered:
-
I tried to base everything on typing in console to access object and function, but after 3 days of bashing my head against the keyboard I understood that it is not the best idea.
(Today I changed design to use DOM and input from HTML side and it seems to be working ok, but I’m still not sure if this is the correct way to do it) -
I wasn’t able to globally declare const
p1
and constp2
(which I want to be a “save” for a user’s hero) and assign to them value returned from functionscp1
andcp2
(create player). Those are executed only if user will press Confirm button which is sending input from text fields. I couldn’t declare it outside the function as there is no input from user when the website is loaded. Maybeasync/await
would be good option?
Finally, I declared it as a global variable inside the function like this:
p1 = new proff(name);
but that means p1
can be reassigned at any point and that’s exactly what I want to avoid.
Please, if you can:
-
Tell me if there is a point to continue with working on this project right now, as I feel that I lack knowledge and skills
-
Point me to the right resources which can help me
-
Show me what mistakes I made in design and execution of the code (how could I improve functionality and readability)
Once again thank you for your time.
If any explanation is needed, I’m at your disposal.
Please be ruthless, I want to know the truth