I'm working on a game using HTML5 canvas where the dialogue is put in several images, each named the same but with a number at the end for its order (dialogue1.png, dialogue2.png
...) and I'm trying to figure out how to make the next image appear each time the enter key (key 13
, I think) is pressed.
I've tried a lot, and after many failed attempts, I think the only way might be to code something like first dialogue1 is displayed
, then if user presses key 13
, then "dialogue" + "parseInt(1) + parseInt(1)"
is displayed, then n + 1
...' Any thoughts?