• Content Count

  • Joined

  • Last visited

1 Follower

About awbummer

  • Rank

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

1386 profile views
  1. So for my use case, I'm simulating typewriter behavior that outputs one word at a time. The solution I came up with, for now, is to do the following (`gorgame` is the wrapper I wrote that encapsulates Phaser 3 in my project, but the logic should be the same): 1. Add bitmap text offscreen using the same font and size that you'll be using for your regular output. We're doing this to get the dimensions of a single letter: const testText = gorgame.add.bitmapText(-20, -20, "msxbit", "AB", 6); testText.setLetterSpacing(20); Notice I added two letters rather than one because that way it'll include the letter spacing. If you aren't including extra letter spacing, adding only one letter should suffice. 2. Gather the letter width and divide it by the word wrap width. This will give you the maximum letters per line: this.letterWidth = testText.getTextBounds().global.width / 2; // divide by two because two letters were added to the test text this.maxLetters = this.wordWrapWidth / this.letterWidth; 3. From here, my suggestion for non-typewritten output would be to split your text into an array of `maxLetter` lengths and rejoin them with new lines (`\n`). EDIT: here's what I came up with for that: addLineBreaks(text, maxLetters) { const split = text.split(/( )/g); let lines = []; function nextLine() { let newLine = ""; while (`${newLine} ${split[0]}`.length < maxLetters && split.length) { newLine += split.shift(); } lines.push(newLine.trim()); if (split.length) { nextLine(); } } nextLine(); return lines.join("\n\n"); } But since I'm simulating typewriter behavior, I'm monitoring the number of letters as each word gets added. This is what it looks like in my code: let str = this.text.concat(`${this.sentence[this.wordIndex]} `); const nextWord = this.sentence[this.wordIndex + 1]; this.letterCount += `${this.sentence[this.wordIndex]} `.length; this.lookAhead = this.letterCount + (nextWord ? ` ${nextWord}`.length : 0); if (this.lookAhead >= this.maxLetters) { this.letterCount = 0; str = `${str}\n`; } 4. If the letter count exceeds the maximum number of letters per line, reset the letter count and add a new line to the typewriter output: if (this.letterCount >= this.maxLetters) { this.letterCount = 0; str = `${str}\n`; } And here's the resulting "wrap" behavior:
  2. I'm stumped on this one. Anyone know how to apply word wrap to a bitmaptext object?
  3. @mtmckenna did you ever come up with a solution to this? Currently struggling with the same issue. Thanks!
  4. I'm also trying to solve this riddle. How does one go about updating an animation's frame rate after instantiation? As @kurhlaa mentioned, overwriting the likely values doesn't do the trick.
  5. Thank you @samme and @kurhlaa. I'm researching containers now.
  6. The following... const testGroup ="test"); const testGroup2 ="test2"); testGroup.add(testGroup2); ...produces this error... Uncaught (in promise) TypeError: child.on is not a function Something I'm missing? Thanks!
  7. @samid737 The player idea is a great one! i will definitely consider that. Thank you for the suggestion @ProSteveSmith Thank you for the feedback! The full release is about a year out, but I may release a couple more demos in the meantime, and if I do, I'll be sure to drop them in here.
  8. Hey yall, I just released a brief demo of Norco: Faraway Lights, a cyberpunk text adventure with a focus on the environmental and industrial histories of rural Louisiana. It features all original, lovingly rendered pixel art and an incredible soundtrack by New Orleans-based composer Gewgawly I. The demo is available for download or to play in your browser on Thoughts and feedback are appreciated!
  9. Hey @Cyclone112 thank you for investigating this! I actually added the same fix you did to avoid the game crashing if someone unplugs the control. I really appreciate the sanity check.
  10. @Cyclone112 good point. I'll add browser and gamepad information to the post. Unfortunately I only have one gamepad to test with but will try to get an XBOX360 controller soon. Thank you!
  11. My Phaser.js version: `v2.6.2 "Kore Springs"` Gamepad: generic Logitech Dual Action controller OS: OSX Sierra Browser: Chrome Update: I can confirm that this also occurs with an XBOX 360 controller. Also see @Cyclone112's comments below for more troubleshooting info. I'm adding gamepad support to my current project, and am encountering the following error when disconnecting the gamepad from the USB input: Uncaught TypeError: Cannot read property 'timestamp' of undefined at c.SinglePad.pollStatus (phaser.js:43607) at c.Gamepad.update (phaser.js:43003) at c.Gamepad.reset (phaser.js:43169) at c.Input.reset (phaser.js:37282) at c.Game.gameResumed (phaser.js:36532) at c.Stage.visibilityChange (phaser.js:31966) at HTMLDocument._onChange (phaser.js:31905) This happens regardless of whether or not I register `onDisconnectCallback` to the gamepad. May also be worth mentioning that I encounter the error when disconnecting from this example: If the Github issue tracker would be a more appropriate place for this, I can post there instead. Any recommendations for a workaround would be great. Thanks!
  12. A while back I started working on a project called "Geography of Robots," which started as a side-scrolling action game and has kind of morphed into an experimental collection of vignettes. My work on the project has been very touch and go, but I spent the past few weeks dumping a lot of love into this latest module, "Swampstar." It's a short, quiet meditation, almost like a little diorama. I built it with Phaser and thought I'd share: Thanks.
  13. It's been a while since I posted this originally, but the tool is now hosted here, if you don't feel like going through the install: