A game attempt - updated project


now id like to preform the task of highlighting the squares after button push and add all 8 values any suggestions here
but here is a link wile im on tonight code pen

Hi @davebowl !

Screenshots are pretty hard to read.
It would be better if you shared a codesandox or codepen link for the project.

http://6ce0c117ce5c.ngrok.io/ retry now

i restarted it i forgot .exe

Maybe you can make those buttons instead of divs and then add an onclick function to perform the task you want.

https://codepen.io/dev_dave/pen/abpNMpP

How is this different from before?

the idea is the razzle button is to represent tossing of marbles onto the board and the number square’s is where the marbles land i was just doing code pen like you suggested

I still think buttons would be a better choice than divs but maybe you could recreate the functionality you are looking for with testing it with just a couple of buttons.

Maybe someone else has a better solution with your current code.

Good luck! :grinning:

1 Like

First of all you can simplify your razzle function with a loop. Next, since you can grab the box’s id from your boxKey, you can use .querySelector to add some styles (or even better, a .highlight class):

const razzleEm = () => {

    for (let i=0; i<8; i++) {
        let newBox = boxKey[Math.floor(Math.random() * 180 + 1)];
        document.querySelector(`#${newBox.box}`).classList.add('highlight');
        dazzledSet.push(newBox);
    }
}

CSS:

.highlight {
  background:#888;
}

You’ll have to make some additional adjustments because you probably want to remove the .highlight class from all buttons when you razzle a second time.

1 Like

incase you was wondering im at this point with the game code pen

Looking good, I don’t really understand the rules but I clicked for a while (can I click more than the razzle button?)

1 Like

well there could be a selector for the bet but as you play every time you hit 29 the price doubles its not 100% yet its a carnival game and it should never get points i adjusted it to get points on black numbers and 15 on 29 as to loosen it up. object is to get 100 points to win

Hey dave nice game :slight_smile:
can`t wait to see all your coming features
cheers Kevin

thanks kevin.anjorin me and my code partner is thinking next to make a dice mode

what kind of functionality do you have in mind if i may ask?

dice link updated yet again

Hi Dave :slight_smile:
How are you ?
Still working on the game?

not really kind of been working on other thing s i did update that last link dice