What if pb's sprites were objects ?

Advanced game related topics
User avatar
Fig
Enthusiast
Enthusiast
Posts: 351
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

What if pb's sprites were objects ?

Post 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
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: What if pb's sprites were objects ?

Post 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.
Post Reply