Arcade Village Blog

Prokofiev on Mars

2023-08-02 Site life
How to introduce a background sound in a javascript game?
The new version of Life On Mars features background music.
I ran into a security issue. Indeed, browsers refuse to launch a background sound in a javascript game without an action from the user.

It is becoming unthinkable these days to offer a game without background music.
To remedy this problem, I force an action from the player.

Each time a player launches the game, I suggest that they click on one of the two buttons allowing them to indicate whether they want to continue their game or start a new one.
Players know to these small panels and clicking on one of the two choices is considered by browsers as a player action.
The interdiction is therefore circumvented and the player has fun with music!

In the background, I chose an extract from music by Prokofiev. I didn't want these modern game music that all look the same and are composed by artificial intelligences.
I like to share my tastes with my users.

For those who discover him, I hope that you will like Prokofiev and that you will try to get to know his work better.

Click here to play Life on Mars
ArcadeVillage.com 1999 - 2024