1 decade ago by Dejan
Hello everyone,
my game is going to have long dialogs. And many of them are too big to fit into the the dialog box. That's why i'm trying to creat a dialog system that can splitt these long dialogs into smaller parts which are at a maximum of 4 rows long. And later I want to give the player the chance to response in special situations with for example " "yes", or "no".
Currently I managed that just 4 of my 9 lines long text is getting shown but unfortunatley I can't seem to exchange the old lines with the new ones.
Can someone tell me what I'm doing wrong, or if there is a better way of archieving what I want?
Anyway here is my code:
Chattext Entity
And the Text array is always stored in the specific NPC Character and is currently looking like this
npc character
Thanks for everyone who is sacrificing his time to help me :) I really appreciate every help.
my game is going to have long dialogs. And many of them are too big to fit into the the dialog box. That's why i'm trying to creat a dialog system that can splitt these long dialogs into smaller parts which are at a maximum of 4 rows long. And later I want to give the player the chance to response in special situations with for example " "yes", or "no".
Currently I managed that just 4 of my 9 lines long text is getting shown but unfortunatley I can't seem to exchange the old lines with the new ones.
Can someone tell me what I'm doing wrong, or if there is a better way of archieving what I want?
Anyway here is my code:
Chattext Entity
update: function() { if(ig.game.pause ==false) { // conversation ended, kill this if(ig.game.unterhaltung==false || ig.game.reden==false){ this.kill(); } } }, draw: function () { this.chat(); }, chat: function(){ var row = 0; var currentLine= 0; var maxRow=4; var xPosition = ig.system.width/5; var yPosition = ig.system.height/4.8; //draw text for (i=0 ; row < maxRow; i++) { if(row< maxRow) { this.font.draw(ig.game.npc.text[currentLine], xPosition, yPosition+30*row); currentLine++; row++; } } //if text is drawn but the end not reached draw the rest if a is pressed if (row==maxRow && ig.input.pressed('a') && ig.game.ende==false) { row=0; } // if end is true and a is pressed, quit this conversation if (row==maxRow && ig.input.pressed('a') && ig.game.ende==true) { ig.game.reden=false; ig.game.unterhaltung =false; } // if all text has been shown set var end on true if(currentLine == ig.game.npc.text.length){ ig.game.ende=true; } }
And the Text array is always stored in the specific NPC Character and is currently looking like this
npc character
ig.game.npc={ name:[ "> Neko <"], response : [false], text:["Hey" + " " +ig.game.spieler.haupcharakterName, "how are you doing today?", "I hope you are doing fine!!! Well I kind of", "need to talk a little bit more for testing matters. ", "So please excuse me for talking nonesense...", "I just hope everything will work out soon.... ", "becouse then I wouldn't get used for such stupid", "testing matters anymore. But oh well, I guess", "it can't be helped. This should be enough text for now"], };
Thanks for everyone who is sacrificing his time to help me :) I really appreciate every help.