Hello everyone
I’ve started my first Twine/Sugarcube story and I’m still pretty inexperienced. I’ve already spent several hours working on the following and haven’t found any answers on the internet. But I don’t think the whole thing should be difficult, which annoys me all the more.
I have defined a portrait image for my player character in the CSS, which can be seen in the speech boxes during the story. Below is the CSS code:
.speech {
color: white;
border: 2px solid white;
border-radius: 5px;
padding: 8px 8px 8px 8px;
box-shadow: 5px 5px 3px Black;
}
.avatar {
display: block;
padding: 1px;
height: 84px;
width: 84px;
float: left;
margin: 0px 10px 0px 0px;
border: 2px solid white;
border-radius: 5px;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.You {
background-color: #333333;
}
.You .avatar {
background-image: URL("img/Portraits/Player_Standard.jpg");
}
At the beginning of the story, the player can choose whether to embody a male or female character. Depending on the selection, the background image of .You .avater should be changed from “Player_Standard.jpg” to “Player_Male.jpg” or “Player_Female.jpg”.
So far, I have only managed to change the image for the current passage. On the next one, however, the standard image is used again.
In HTML, I display the speech box as follows:
<<speech "You">>Ugh, what time is it?<</speech>>
Can you tell me the easiest way to do this?
Thank you and best regards!