Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Heh, I was just thinking I should take another look at squash and stretch - I couldn’t find a goad way to change size based on an image’s default aspect ratio rather than it’s parent’s aspect ratio or a fixed shape.

If you don’t mind explaining, what would the parent be? And by fixed shape, does this mean that the image can be transformed into arbitrary polygons, as long as it’s in the same aspect ratio? This is more a curiosity than anything (also thank you for taking a stab at this, even when it proves to be more complicated than I thought).

Or…hmm. Let me know if that’s too involved and I’ll shove it on a branch of the repository and send you a link.

I think I can do this now that you’ve told me where to look.

I believe printing variables in ink is just putting curly brackets around the variable name.

Oh, I mean to have it shown on the VN screen at all times, not in dialogues.

If you don’t mind explaining, what would the parent be?

Not polygon, just any rectangle. The parent element in this case would be the display area where the sprites show up: it's currently a 2:1 aspect ratio. So if I did the naive thing and just gave you width and height, then "10 10" would be 10% of the display width and 10% of the display height, so the image would get stretched to a 2:1 rectangle no matter what size it was initially. That would let you do squash and stretch, but to get an image to be not stretched, you'd have to do the math to convert backwards to the image's actual aspect ratio (like a square image would need to be 10 5). Which seems... inconvenient.

Oh, I mean to have it shown on the VN screen at all times, not in dialogues.

Oh, I see. You can get ink variables in the javascript with story.variablesState["variableName"] but you'd need a way to display it. You could console.log it in continueStory? Or you'd have to find a place to put it in the HTML, maybe add a div or span with an id and get the element with document.getElementById, and then set element.textContent = story.variablesState["variableName"]

I’ll try that, thank you! It has been informative so far.