Book Extension

MarthGelaude

  • Posts: 2
Hi everyone,

I would like to make an extension that expands on the Book template that comes with StencylWorks. The plan is that it would read a pdf file, and turn each page into an image (If this won't work, then I would load something and turn it into something that stencyl can put into a scene). Then, a new scene would be added for each image, and that image would be set as the background for that scene. Thus, turning a page would be the equivalent of switching to the next scene. Eventually, I would like to make a transition similar in function to the fade in/out methods, except this would be a page curling animation.


So, here are my questions:

1. Is there any way to programmatically create and add new scenes, grab all the images from the resources section, and then set these images to the background of those scenes? I suppose this would be possible manually, but to do this for 20+ pages every month would be tedious and inefficient.

2. I know there is no functionality for handling pdfs, but is it possible for a user to open the file, and have my extension process that file?

3. After loading the pdf and turning each page into an image, would it be possible to add these images as resources to the project?

4. Is it possible to create custom scene transition animations?


An answer to the first question would be most helpful, but if anyone can answer these questions, I would really appreciate it. And of course, were I to make this extension, StencylWorks would be free to distribute and modify the extension as they see fit.

captaincomic

  • *
  • Posts: 6108
Hi!

I'm not sure if you need to write an extension for this, maybe you can do it with some behaviors.

1) I don't know if it's possible to create scenes with code. Instead you could do everything in one scene, and make each page an animation of an actor.
2+3) StencylWorks cannot import PDFs. I would suggest you use an image converter to convert the PDF to PNGs (e.g. imagemagick). Maybe create a "spritesheet" from the pages, then you could import all the pages in StencylForge in one step.
4) Maybe it's possible somehow, but a page curling where you can see the text on the page being flipped could be difficult.

And I'm curious, what kind books do you want to create with this?

Photics

  • *
  • Posts: 718
PDF in an app doesn't seem like a good idea.

I think HTML5 is a better idea.

I published a textbook as an app... http://photics.com/books/gamesalad-textbook ...and that uses a webview with HTML content. Maybe transitions could be done with JavaScript / JQuery or HTML5. I think StencylWorks might be getting webview support. I mentioned to Jon that it would be more useful if web files could be stored locally. If that happens, then StencylWorks could be used as a book engine... by using basic HTML skills to format the content.

I've been working on a textbook for StencylWorks. It's going to be a PDF. It can be cool to make a book as an app, but people don't always want to read from mobile devices.

« Last Edit: February 21, 2012, 03:55:13 pm by Photics »
Michael Garofalohttp://photics.com – Author of The Interactive Stencyl Textbook 8)

MarthGelaude

  • Posts: 2
Hi!

I'm not sure if you need to write an extension for this, maybe you can do it with some behaviors.

1) I don't know if it's possible to create scenes with code. Instead you could do everything in one scene, and make each page an animation of an actor.
2+3) StencylWorks cannot import PDFs. I would suggest you use an image converter to convert the PDF to PNGs (e.g. imagemagick). Maybe create a "spritesheet" from the pages, then you could import all the pages in StencylForge in one step.
4) Maybe it's possible somehow, but a page curling where you can see the text on the page being flipped could be difficult.

And I'm curious, what kind books do you want to create with this?

Those are all excellent ideas! Thank you! That actually solves most of my problems.
I think I have an idea for the page curling. I just wanted a generic animation to play, so I suppose I could just have an actor on a layer above the page play the animation, which would cover up the page while I switch it to the next frame.

I want to intersperse ads every X number of pages read, but I'll try to figure out how to do that myself first.

I'm actually trying to see if I can help a friend with a comic book magazine that she's trying to start up. It's going to have more than just the magazine, but I really shouldn't say more than that.