Hello everybody! Ever since my school days, I really love science fiction. In those early days, my favorite was Harry Garrison's cycle of novels about the Steel Rat. One day I decided to take home from the school library a binder of the magazine "If" for the weekend. Looking through the magazines, I found in one of them a book-game of the aforementioned science fiction writer. The work is called "Become a Steel Rat" and is a text quest in which the reader, in the course of the plot, must choose the options of action from the proposed ones. It was especially interesting to wander in the labyrinth. There was no need to go there without a notebook and a pencil!
Not so long ago I wondered if there were any variants of the implementation of this game in any programming languages ββon the Internet. Digging around on the web, I found this site . On the site you can see a script that generates a ready-made html file with a book. The link to the source in the script does not lead anywhere. The resource is locked. I was not interested in the script, but in its product and what could be improved in this product. Below the script, in the comments, there are two links. A ready-made game opens on them. Using browser tools, you can view the source code.
Appearance
The original version looks like this:
Pretty boring. I decided to add a background image, change the text background color, font size and some other changes. Details will be below. It turned out like this:
, . .
. . :
. css-:
i {
cursor: pointer;
background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQECAQECAgMCAgICAgQDAwIDBQQFBQUEB QUFBggHBQYHBgUFBwkHBwgICQkJBQcKCgoICggJCQj/wgALCAAtACwBAREA/8QAGwAAAgMBAQEAAAAAAAAAAAAABgcEBQgCAwn/2gAIAQEAAAAB+zdD Wxyy5FAAc4AtfBIfe0adbXjDJ+UuXGa9nRF1ti8ReInBsko//8QAHhAAAgMBAQADAQAAAAAAAAAABAUBAgMABhESExT/2gAIAQEAAQUC23rhXT9LxNx46Cv ykUyhMdGn2s2IYV6qi9uJ0MBHqwNDJGIzLHpMQOyy23J5nWJFMr9aeTcUoBiw/lC1YyTAZND7mD5cbNddfEAVaLfTLZwpnlr8w0/DPW55FSxt22y1eMqA5340I mWXp26ojyqc/wBNZSmXJBu//8QANRAAAgECAwQFCgcAAAAAAAAAAQIDAAQRITEFEhNBEBRRYaEiJDJSU3GBkbHhBkJDcsHC0f/aAAgBAQAGPwLFgWY5Ko1Y 1vXU5iX2cRw8dayt9/vbWsUZ4+4tvCsNJBqOi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Bj7PI4Kk PKg1HoC/1zjTHn2P0ezQTkwAlegiHQE2iKtFDBaAq17SIHaW6x4rugOBoqKtKub+vSsjRplWzSnRjAnKRqMeUdR0AB+C0A61Tsq9riCIgEiJRMMifRjYvlnAnk5eelvIr ZUqRz3rYO3LAmNdBkFRMXKK4ZalhVTlfj//Z');
display: block;
width: 44px; height: 45px;
margin-top: 10px;
}
:
<i onclick="Coin([32,118])" title=""></i>
, , :
Coin
:
function coin(n) {
location.hash = '#a' + n[Math.floor(Math.random() * n.length)];
}
. , img
:
<img src="images/coin.png" onclick="coin([190,277])" title=""></img>
:
img {
cursor: pointer;
display: block;
width: 55px; height: 55px;
margin-top: 10px;
}
:
html {
background: url(images/background.jpg);
background-repeat: no-repeat;
background-size: cover;
}
body {
background: #EDDDB5;
color: black;
font: 20px/1.4em Helvetica, 'Trebuchet MS', Arial, sans-serif;
padding: 20px;
margin: 100px;
}
header {
font-size: 25px;
margin: 0 0 20px;
padding: 0 0 5px;
border-bottom: 2px solid #ccc;
color: #DD5F5F;
}
:
html {
background: white;
}
body {
background: #eee;
color: black;
font: 14px/1.4em Helvetica, 'Trebuchet MS', Arial, sans-serif;
padding: 20px;
margin: 100px;
}
header {
font-size: 25px;
margin: 0 0 20px;
padding: 0 0 5px;
border-bottom: 2px solid #ccc;
color: #ccc;
}
, . , . :
<i onclick="Coin([80])" title=""></i>
:
? [<a href="#a80">80</a>]
html- , .
, . !