This thread provides you with an solution for converting your sprite images to vector format, These vector representations can then be imported into PlayBasic and used for collision purposes in your games.
Please see the updated code/example is posted bellow.
Note: The code does NOT perform the Raster To Vector operation it self, it merely provides you with a loader code that can import the files from (in TXT format) RasterToVector in Playbasics shape engine.
Go here to download the the software (DEMO) . Remember if you like the software, purchase it !
http://www.raster-vector.com/ (http://www.raster-vector.com/)
After searching there's loads RasterToVector programs,but not many free ones.
This one is free ware, but I haven't used it as yet.
http://potrace.sourceforge.net/ (http://potrace.sourceforge.net/)
HERE (http://www.freeserifsoftware.com/software/DrawPlus/default.asp?SP=G500_UK&kwd=raster_to_vector_conversion) is a link to a freeware piece of software that says it can convert bitmaps into vector. I'm downloading it now (24Mb), so I haven't tested it yet.
HERE (http://www.masternewmedia.org/2004/02/28/autotracing_how_to_convert_bitmaps.htm) is a list of programs that say they do the same. Both of the above software solutions are listed.
Was having a look at writing cad format DXF loader. But it's fair mouth full to wade through.. Will have to come back to it.
http://www.autodesk.com/techpubs/autocad/a...0/dxf/index.htm (http://www.autodesk.com/techpubs/autocad/acad2000/dxf/index.htm)
QuoteWas having a look at writing cad format DXF loader. But it's fair mouth full to wade through.. Will have to come back to it.
http://www.autodesk.com/techpubs/autocad/a...0/dxf/index.htm (http://www.autodesk.com/techpubs/autocad/acad2000/dxf/index.htm)
[snapback]8131[/snapback]
Ermmm... What spoken language is that in? :P
all of them :)
*=------------------------------------------------------------------=*
>> Loading Vector (Collision) Shapes V0.002 <<
By Kevin Picone
Last Updated 11,Jan,2006
www.PlayBASIC.com
*=------------------------------------------------------------------=*
This Example load the TXT output from RASTER to VECTOR into a shape. How well this works, depends on how well the image was traced by the program.
To get the best results when building collision shapes, convert your images to a mask (all pixels to the same colour) first, then convert the masked versions. This should give a clear outline of image. (i've included a simple program to does this)
The loader function (bellow) expects the provided file to be a TXT format. The file will contain the various POLYLINE lists followed by the actual vertex. Each list is closed with an END TAG. Thus each list creates and enclosed polugon
eg
POLYLINE
34 53
39 46
43 33
44 33
51 25
55 16
53 14
38 13
37 10
26 10
25 14
9 15
9 19
18 31
21 34
26 48
29 53
34 53
END
Note: The Y cords need to be inverted for use with PB.
I've NO idea if TXT vector formats are commonly set out this way, or this is just the way it's exported from the Raster2vector program. So you'll have to experiment with some others
*=------------------------------------------------------------------=*
Go here to download the (DEMO) Raster2Vector software
http://www.raster-vector.com/ (http://www.raster-vector.com/)
*=------------------------------------------------------------------=*
here's a picture of this one running. Demo allows you to move the ship around and includes Shape to Shape collision with the Main PlayBASIC Logo. The small one is just there for a bit of backdrop :)
Sprite Collisions Links In PlayBASIC
Manually Doing Pixel Perfect Sprite Collisions (Examples & Video) (https://www.underwaredesign.com/forums/index.php?topic=4432.0)
Sprite Collision With An Image Mask (https://www.underwaredesign.com/forums/index.php?topic=2637.0)
Sprite Collision Mode (SpriteCollisionMode) Documentation (https://playbasic.com/help.php?page=SPRITES.SPRITECOLLISIONMODE)