Heppell08 Posted March 17, 2014 Share Posted March 17, 2014 I have a Kern of Duty cutscene in my game and its pretty important to the look and feel of my game. Problem is, its just stopped working even though i havent touched it.I logged a few parts of the update to see what the issue might be and found this:f (this.time.now > textTime && index < content.length) { console.log('Typing'); // get the next character in the line if (line.length < content[index].length) { console.log('Typing 2'); line = content[index].substr(0, line.length + 1); style01.setText(line); textTime = this.time.now + 80; } else { textTime = this.time.now + 2000; if (index < content.length) { index++; line = ''; } } }where it says console.log('Typing');That only fires 3 times, then stops, but the content array has this in it:var content = [ "Loads of story and stuff", "goes in here", "but now it doesnt work?",];I have no idea whats wrong? I'm looking at the Kern of Duty file and nothing is any different other than a few timed events i placed in and a few images etc. Link to comment Share on other sites More sharing options...
rich Posted March 17, 2014 Share Posted March 17, 2014 Looks like it is doing exactly what it ought to from here - you've got 3 lines of text in your content array, it's displaying them all and then stopping (just like the original version does). No-where is the index reset or the timer reset or anything to make it do otherwise. What is it you were expecting it to do? Link to comment Share on other sites More sharing options...
Heppell08 Posted March 17, 2014 Author Share Posted March 17, 2014 That's exactly what I'm saying rich. There's no text appearing on the screen. I even copied the kern of duty file itself and still got no text displaying at all. I use states and the only change I did to the original kern file was function create() to create: function() for all the functions. Any idea why it just stopped working?It did work though and that's what I don't understand. Link to comment Share on other sites More sharing options...
rich Posted March 18, 2014 Share Posted March 18, 2014 The Kern of Duty example works fine for me under 2.0, so there must be something else in your code / set-up causing this, that can't be figured out from the bit of code pasted above. Link to comment Share on other sites More sharing options...
Heppell08 Posted March 18, 2014 Author Share Posted March 18, 2014 But the 1.1.5 example works fine when I look at it in examples on node-webkit. Soon as I put it in my game with the only mod to the code is:From function create()To create: function()That's the only thing changed from the original Kern file. I can post the whole code if needed? Link to comment Share on other sites More sharing options...
rich Posted March 18, 2014 Share Posted March 18, 2014 Approach this logically: 1) If the code is identical, and I mean identical (beside swapping to a prototype function) then it has to be something else within the game causing it. Or ...2) The version of Phaser that Examples is using isn't the same as the one your game is. Or ...3) node-webkit is bugging out, for some reason best known only to itself. There's literally no other explanation I can fathom. Link to comment Share on other sites More sharing options...
Heppell08 Posted March 18, 2014 Author Share Posted March 18, 2014 so can you see what is wrong in here? This is the full file i'm using and this used to work. Literally all of my story/cutscene files have stopped working... SimpleGame.Story = function (game) { };var content = [ " ", "Welcome subject", "We need specimen Ytivarg A.S.A.P!", "It's of the highest order possible", "and the highest confidentialiaty! ", " ", "Nobody must know of this rescue mission", "I'll put YOU in control of Ytivarg!", " ", "Objective: Escape the lockdown facilty!", " ", "mission briefing over... ",];var textTime = 0;var style01;var index = 0;var line = '';var skipButton;var skipTimer = 0;var skipText;var bg;var animplayer;var stateTimer = 0;SimpleGame.Story.prototype = {preload: function(){},create: function() { bg = this.add.sprite(0,0,'backdrop1'); animplayer = this.add.sprite(200, 270, 'player01'); animplayer.animations.add('walk',[0,1,2,3,4,5], 6, true); animplayer.alpha = 0; animplayer.scale.x = 1.5; animplayer.scale.y = 1.5; var style = { font: "22px Courier", fill: "#19cb65", stroke: "#119f4e", strokeThickness: 2 }; skipText = this.game.add.text(this.game.width - 320, this.game.height - 30, 'Hold Space or Finger down to skip',{ font: "14px Courier", fill: "#19cb65", stroke: "#119f4e", strokeThickness: 2 }); skipText.visible = false; style01 = this.add.text(220, 120, '', style); textTime = this.time.now + 80; skipButton = this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);}, update: function() { skipTimer++; if(animplayer.alpha < 0.9) { animplayer.alpha += 0.1; } animplayer.animations.play('walk'); animplayer.body.velocity.x = 30; if(animplayer.x > 800) { this.game.state.start('Game'); } if (this.time.now > textTime && index < content.length) { // get the next character in the line if (line.length < content[index].length) { line = content[index].substr(0, line.length + 1); style01.setText(line); textTime = this.time.now + 80; } else { textTime = this.time.now + 2000; if (index < content.length) { index++; line = ''; } } } if(skipTimer > 10) { skipText.visible = true; } if(skipTimer > 50 && skipButton.isDown || this.input.activePointer.isDown) { this.game.state.start('Game'); } }}; Link to comment Share on other sites More sharing options...
1-800-STAR-WARS Posted March 18, 2014 Share Posted March 18, 2014 I just copied the above code, and took out the player and bg sprites (as I don't have them). Seemed to work as expected. Are you sure you're not somehow drawing the background on top of the text? Link to comment Share on other sites More sharing options...
rich Posted March 18, 2014 Share Posted March 18, 2014 Same as Lewis. Link to comment Share on other sites More sharing options...
Heppell08 Posted March 18, 2014 Author Share Posted March 18, 2014 No I removed the same stuff as you guys did and still nothing. I'm not sure if its an issue with node-webkit now then... Hmmm... Thanks anyway guys. I'll have to look at something going on at my end then. Link to comment Share on other sites More sharing options...
rich Posted March 18, 2014 Share Posted March 18, 2014 I was trying it just in Chrome. Link to comment Share on other sites More sharing options...
Heppell08 Posted March 18, 2014 Author Share Posted March 18, 2014 Yeah Rich I tested chrome and firefox but got nothing. Cache deletion and clear all the other stuff and I'll try again. Just seems strange since webkit did work but then just stopped working. Its got to be something in my set up. I'll find the cause somewhere. Link to comment Share on other sites More sharing options...
Recommended Posts