Jump to content

Kern of Duty 1.1.5


Heppell08
 Share

Recommended Posts

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

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

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...