Welcome back.
In the earlier lesson, we set up our HTML, then use JavaScript in order to listen for the DOM content
to be loaded, and now we're ready to initiate and set up our gameplay and we can do this in the same
way.
So if you're not creating the same game, if you want to create different types of games, the methodology
is the same.
You come into your HTML application and you look at what do you what does a user need in order to interact
with their content?
So they're going to need an input.
That's why we created an input.
They're not going need a button trigger, an event that's going to pick up that input information.
So when they're ready and they've updated the input, they need a way to trigger that event.
And then we also needed a way to communicate back to the user.
And that's why we created that message element and the same thing here when we initiate the game.
So what do we want to set up?
The user has just come into the game and we should provide a message to that user about what's happening
and what they can expect within the game.
And with the messaging.
The way I usually like to do it is I like to create the ability to have different ways to easily message
to the user, because this is a function that we're going to be using over and over and over again.
So let's create a function in order to handle that.
So this is a message and we can just have mess in here.
And then any time any of that content is sent out to us, we can update the inner HTML of that element
with the value of message.
So this way we can actually pass an HTML code and update it where you're taking that same message elements
and we're going to update one of the style properties to it.
So set the colour of the font so we have an option to have different font colours.
And if we are passing in a value here, we're going to set that for the user.
And if there's no value, then the colour will just be black.
And for now we'll type welcome to the game and person of value for red and see if it goes to red colour.
So we refresh and we get a message and it's red going.
Welcome to the game.
And we should also provide some instructions.
So I'll create a temporary message.
Instead of having that here, we're going to pass that information and we have more flexibility in the
content that we're outputting from.
And this is where we're going to also add in some dynamic capabilities, game minimum value to and then
whatever we want the game maximum to.
So this is our initial value and we can set that here when we're setting up game as well, or we can
set it within this option.
So let's call it a minimum.
And this is just the number that we're going to use to be the minimum value that the guests can be.
And then our maximum value is going to be ten.
So I guess a number from one to ten.
And that's where getting those values and you can use the game logic in order to create even more functionality
instead of sending it as read.
Let's set it up as you come into the game.
Welcome to the game.
Gets a number from one to ten.
So the instructions are fairly clear.
We've got an input area where the user can input some content and then they can click yes, in order
to trigger that check to make sure that they've guessed it properly.
So the thing that we need to do whenever we start the game is we need to create that number that they're
guessing.
So whatever value we want them to guess, we need to generate that.
So that's coming up in the next lesson set up, the ability to send messages, date the style colour
of the font, and then set up that initial message and have some dynamic values within the game that
can be updated within the gameplay to make it easier or harder.
And you got to be ready to move on to the next step.