Page Flip Effect
SaintBass

Hi everyone, i'm programming a game and i need a "page flip effect" some idea?.
Thanks for the help :)

pkrcel

Sorry but it's a bit vague, you mean like an animation of a page flipping while (I presume) the player is reading a book? (like in an rpg of sorts?)

Mark Oates

Yea, maybe a bit more information? :). There are a bunch of different ways to do a page flip animation. What kind of thing did you have in mind?

SaintBass

The book is the creation of the heroe is something like this: http://pageflip-books.com/#meetpageflip/page/1

You can select the race, class, name and all the attributes of the heroe.

Mark Oates

OK. :)

What version of Allegro are you using? Allegro 5 or Allegro 4?

SaintBass

Allegro 5 :)

beoran

It's easy enough, I think, if you have your pages as bitmaps. Set up a clipping rectangle with void al_set_clipping_rectangle(int x, int y, int width, int height), then draw the page bitmap rotated with al_draw_rotated_bitmap(). You may need to use transformations (rotation and translation) to make the final result look good.

Mark Oates

Probably the easiest way to achieve an effect like that is to use al_draw_scaled_bitmap(), and scale the bitmap horizontally. (Each page would be an ALLEGRO_BITMAP) It would give you rectangular shaped pages; without perspective. Here's a mock-animation of what it might look like:

609734

Probably the most elaborate way would be to setup a 3D projection and create a mesh of ALLEGRO_VERTEX that deforms like paper as you flip it.

[edit: I don't know why the proportions on that gif are all messed up. hmm. something to do with the forum image embedding?]

SaintBass

Thanks for the help guys i´m going to try the ALLEGRO_VERTEX Effect. :D

Thread #615729. Printed from Allegro.cc