Title Card Plugin


start:
  - show store: CONTINUE
  - show marco: 
  - marco says: Let's see, next we have...
  - call SHOWTITLE:
    title: Act III
    subtitle: Fighting under the Rain
  - marco says worry: What? That's not right.
  - show jair: happy AT RIGHT
  - jair says: That's right, get ready!
  - marco says normal: Wait, I think there's a better way to solve this.
  - show jair: normal WITH CUT
  - call SHOWTITLE:
    title: Act IV
    subtitle: No More Rain nor Fights
  - marco says happy: Much better.
  - jair says angry: What? That makes no sense. I'm outta here.
  - hide jair:
  - marco says: Bye bye!
  - endgame:
									


backgrounds:
  store: assets/backgrounds/store.jpg

characters:
  marco:
    displayName: Marco
    speechColour: "#123022"
    looks:
      normal: assets/characters/Char1NormalSchool.png
      happy: assets/characters/Char1HappySchool.png
      angry: assets/characters/Char1AngrySchool.png
      worry: assets/characters/Char1WorrySchool.png
  jair:
    displayName: Jair
    speechColour: "#6a2b2b"
    looks:
      normal: assets/characters/Char4NormalSchool.png
      happy: assets/characters/Char4HappySchool.png
      angry: assets/characters/Char4AngrySchool.png

extra:
  image:
    title: assets/lessons/titles.png
								


class SHOWTITLE extends RenJS.Plugin {

    onCall(params) {
        // load 'title' background in extra section of setup!!!
        const bg = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'title');
        bg.alpha = 0;
        bg.anchor.set(0.5);
        const style = {...this.game.gui.hud.cHandlers.default.config.text.style};
        style.fontSize = '50pt';
        const title = this.game.add.text(0, -20, params.title, style);
        style.fontSize = '25pt';
        const subtitle = this.game.add.text(0, 40, params.subtitle, style);
        subtitle.anchor.set(0.5);
        title.anchor.set(0.5);
        bg.addChild(title);
        bg.addChild(subtitle);
        this.game.managers.tween.chain([
            {sprite: bg, tweenables: {alpha: 1}},
            {
                sprite: bg, tweenables: {alpha: 0}, callback: () => {
                    bg.destroy();
                    this.game.resolveAction();
                }, delay: this.game.storyConfig.fadetime * 2
            }
        ], true, this.game.storyConfig.fadetime * 2);
    }
}

RenJSGame.addPlugin('SHOWTITLE',SHOWTITLE);
								

Return to the Gallery Download from Github