Page 1 of 1

What if pb's sprites were objects ?

Posted: Wed Feb 27, 2019 8:54 pm
by Fig
A small test, turning pb sprites into objects ...
Simplified reading of a sprite sheet (we just give the name of the sprite sheet, the line number we want to add with the name of its sub-animation ...)

Simple addressing of an animation and sub-animation by a string (for example the animation "Hero" and the sub-animation "Kick" ...)
Play / pause of an animation, modification of speed's display, display by depth's order, progressive transparency until invisibility and vice versa etc ...

Lots of things to add and debug : collision with quadtree returning a list of the objects concerned, Gui in sprites, pathfinding, gravity and objects on which we can stand...
http://dl.free.fr/cOBhXufjw
Compile the Example.pb file of the archive.
Direction arrows and space to interact. (left Ctrl key for a transformation)

The blue and red character just illustrates the replacement of a color in an animation and the duplication of an "object" of type animation.
Backgrounds illustrate the scrolling mode. (and my lazyness to use photoshop ... ^^)
I used some of the animations of this Megaman spritesheet, taken on this site http://www.sprites-inc.co.uk/, for the example.

I made a deposit on GitHub, if you want to participate in the improvement of the program ...
https://github.com/FoxFig/2DSpriteObject

Image

Re: What if pb's sprites were objects ?

Posted: Wed Feb 27, 2019 10:39 pm
by Mijikai
Definetely a good idea i went a similar route when i wrote the gfx part of my 2D engine.
Its way more straight forward and pleasant to work with.