Now that we've built the gameboard, we've built the deck.
We've shuffled the deck, let's add in adding the button clickers.
So create another function.
And is just a series of commands here that we're gonna have that are going to do all of functionality
for the game.
So add clicker.
It's gonna add the ability to click on the buttons.
And we already have all of the buttons created.
And we have them as objects within the game object.
So now it's just a matter of connecting to those buttons and adding the functionality that we want.
So let's create a bunch of functions.
They're going to add the functionality for clicking.
So first we've got the button BEATTIES and deal object and add of that listener.
So that listener that we're adding force are gonna listen for a click on that object and that's going
to initiate the function called deal and we can create that function for that.
So just function deal.
We can do the same thing for the other buttons where we can add in all the different functionality that
we want.
So we had another button that was button stand.
So making all of the buttons playable.
How about we call this one player stand and let's do a few other buttons.
We've got button hit.
And these, of course, are very crucial part to playing the game where we want the player to have the
ability to interact with what's happening on the screen.
So player, next card.
And then let's say that.
So we need to create the functions in order to handle that.
So we don't have functions for player stand and for next card as we were throwing that error.
So player stand.
And this would just be kind of like placeholder functions as we're building this to come back to later
on.
So see that and no more error.
So that means that we're ready to continue to build this.
So what we wanted to do is be able to deal out the cards.
And so let's start building what we need for deal and move this up a bit.
So it's easier to see.
So top.
And coming in.
Let's clear out whatever might be within the dealer hand.
So a build out that the dealer hand object.
And this is whatever the contents of the dealer hand is going to be.
And player hand.
So this will allow us to continue and build another round into the game where we're gonna be able to
clear whatever the existing hands are.
And take additional cards.
I'm going to also create one that's called game start.
So it means that the game is in play and no more betting closing off the betting and that sort of thing.
So give us the ability to kind of turn and disable things.
And then the game, there's the player cards.
So let's update the inner H.
Timal.
And for now, we're just put deal.
And we're going to update this, obviously, with cards later on.
And same for the dealer hands.
So deal.
So to see what happens, sir, refresh.
Deal.
And we get the contents being updated.
So you see that through the contents are updating within the play area.
So we need to add in.
Cards in there and we need to play the whole game play affect.
So we also need to disable the ability for a hit and stand.
And we also need to disable those buttons by default.
So we're gonna have another function that we're going to set up in the next lesson, which is going
to be able to toggle some of these buttons to have the right gameplay, because we don't want the player
to be able to come in and hit to bet hit and stand when they have no cards being output yet.
So that's all going to come in the upcoming lessons.
So go ahead and add in the ability to deal.
Make sure that your deal button is working and running.
And you can also check the hit and stand can out in a console message whenever these buttons get clicked
for the actions to make sure that you've got the actions and that they're ready to go and you can be
ready to move on to the next lesson where we're going to disable the buttons that aren't in play and
that aren't available to the player.