This is a small collection of scripts, that allows game developers to add interactive books to their game, where the user can flip the pages using their mouse pointer / finger. The scripts are incredibly easy to use, and allow the developer to add as many books simultaneously as they want.
Currently, the package consists of four easy to use scripts. These are as follows: book_create( page_viewing ); // returns a new book ID book_delete( book_id ); // destroys the book with the given ID book_add_page( book_id, background_id ); // adds a page to the book, using a background's texture book_draw( x, y, width, height, book_id ); // draws a book at position x, y, at width pixels wide, and height pixels tall. This script handles all of the page dragging features.
Example executable: https://www.dropbox.com/s/kp36gqx2du30mk1/page_flipper-Default-22.214.171.124.zip?dl=0
More scripts are coming soon, which will let the user: - Remove a page from a book - Replace a page with a new background texture - Retrieve the page flipping target direction - Retrieve which page is being dragged (left or right) - Retrieve the horizontal page flipping completion - Retrieve the vertical page flipping completion - Retrieve the complete page flipping completion
Each book is basically a ds_map with a few variables under various keys, and a ds_list of background textures (which holds the pages) under one of the keys.
This asset comes with a working example. In the example, I've created four ds_lists which contain each books x and y coordinates, the book ID at that position, and the books scale. The example uses pages that are 480px wide by 640px tall.
** Please note - you currently have to edit backgrounds to give them the right aspect ratio for the pages.