PureBasic Forum
http://forums.purebasic.com/english/

What if pb's sprites were objects ?
http://forums.purebasic.com/english/viewtopic.php?f=16&t=72365
Page 1 of 1

Author:  Fig [ Wed Feb 27, 2019 8:54 pm ]
Post subject:  What if pb's sprites were objects ?

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

Author:  Mijikai [ Wed Feb 27, 2019 10:39 pm ]
Post subject:  Re: What if pb's sprites were objects ?

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.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/