Behavior: Draw/Fill Terrain

Greg

  • *
  • Posts: 1260
I'm working on a Behavior that will allow you to draw the outline, or fill the Terrain in your Scene.  You can already do this (partially) using debug drawing, however this turns on debug drawing for everything and it only draws the outline.

This will allow you to specify the stroke color, stroke size, and fill color.  I'm still working out a few drawing issues where some of the shapes flicker.  If I can figure that out, I'll upload the Behavior soon.

The only other issue is that the polygons composed of multiple shapes show each shape's outline drawn separately (when using a stroke color).  I'm trying to find a way to make it draw as one shape, although I'm not quite there yet.


Darkhog

  • Posts: 1243
By the way - can I know why terrains are split up into several shapes while if I make same shape from tiles it stays combined?


//edit: attached example image.

« Last Edit: May 02, 2011, 07:57:27 am by darkhog »

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Alexin

  • *
  • Posts: 3132
Box2d does not support concave shapes, they must be convex. It's the reason why complex shapes, and potentially concave, are split into smaller convex shapes.

I believe tiles shapes are also split, you just don't see it as you do with the terrain.
"Find the fun"
alexin@stencyl.com

Greg

  • *
  • Posts: 1260
I believe tiles use Box2d loop shapes rather than polygons.  I can't remember off hand why I didn't use these for Terrain, either I had already implemented it, or I ran into problems using loop shapes.   

Jon

  • *
  • Posts: 17516
Loop shapes can't be moved, IIRC.

Greg

  • *
  • Posts: 1260
Yeah that may have been it. 

Just made a few more tweaks to leverage the color that you can specify within the Scene designer for a Terrain (double clicking it).