Skip to content

netgfx/Phaser-typewriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forthebadge

Phaser-typewriter

A typewriter effect wrapper for Phaser.io Javascript library

Initialize the typewriter anywhere in your game

var typewriter = new Typewriter();
typewriter.init(gameInstance, options);

pass necesery options like: context (the object that launches the typewriter)

typewriter.init(gameInstance, {
    x: 290,
    y: 40,
    fontFamily: "chillerBlack",
    fontSize: 26,
    maxWidth: 300,
    sound: reg.track,
    text: "Some text to be typed!"
  });
  typewriter.start();

View example: Complete example (make sure to listen to the writing sound playing in the background ;) )


Game Instance The game instance that we want the tooltips to appear to, such as "game"

General Options:

  • text: The text to be written automatically
  • x The x position of the text (default: 100)
  • y The y position of the text (default: 100)
  • writerObj A Phaser.Text or Phaser.BitmapText object, pre-created
  • writerFn: The function to call when writing the text (default: null)
  • endFn: The function to call when the writing ends (defailt: null)
  • time: The duration of the animation effect writing each letter (default: 100ms)
  • maxWidth: The maximum width where the text will wrap (default: 200)
  • fontFamily: The font family for the text to be writen (default: Arial)
  • fontSize: The font size for the text (default: 28)
  • sound: The sound effect to play during the typewriter effect, it auto-stops when typing ends (default: null)

API Functions

  • init: Adds the options and game object to the Typewriter constructor
  • start: Enables and starts the typewriter effect
  • destroy: Destroys the typewriter object
  • hideText: Hide the text
  • showText: Show the text
  • moveToTop: Move the text to the top

Buy me a coffee or tea!


The TODO list is diminising!

Please let me know if you come across some bug or have something to contribute

About

A phaser helper for the typewriter effect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •