Ah! Ok, I said my last post was the last question, but I've got like two more I really need to ask. First:
sync on
sync rate 60
`world = b2createworld(-1024, -1024, 10240, 1024, 0, 0, 0)
world = b2createworld(-2048, -4096, 20480, 4096, 0, 0, 0)
VertexData = alloc(24)
poke float VertexData, cos(240)*32.0 : poke float VertexData + 4, cos(240)*32.0
poke float VertexData + 8, cos(120)*64.0 : poke float VertexData + 12, sin(120)*64.0
poke float VertexData + 16, cos(0)*32.0 : poke float VertexData + 20, sin(0)*32.0
ShapeTemplate = b2CreatePolygonShapeTemplate(3,VertexData,0.1,10,0.1)
`btemplate = b2createpolygonshapetemplate(4, VertexData, 1, 1, 1)
`b2setpolygonshapetemplatevertex btemplate, 1, 0, 0
`b2setpolygonshapetemplatevertex btemplate, 2, 100, 0
`b2setpolygonshapetemplatevertex btemplate, 3, 100, 100
`b2setpolygonshapetemplatevertex btemplate, 4, 0, 100
dim body(30, 1) as double integer
dim star(150)
for n = 1 to 30
`ShapeTemplate = b2createpolygonshapetemplate(rnd(50), rnd(50), rnd(50), rnd(50), rnd(50), rnd(50))
body(n, 0) = b2createdynamicbody(world, 0, 0, 0, 1, 1, 0)
if n > 1
body(n, 1) = b2createboxshape(body(n, 0), 0, 0, (rnd(62831)*1.0) / 10000.0, rnd(256), rnd(256), 0.1, 10, 0.1)
else
body(n, 1) = b2createboxshape(body(n, 0), 0, 0, 0, 32, 32, 0.1, 10, 0.1)
endif
`b2setshapetemplatedensity ShapeTemplate, 0.1
`b2setshapetemplatefriction ShapeTemplate, 10
`b2setshapetemplaterestitution ShapeTemplate, 0.1
`shape = b2createshape(body(n, 0), ShapeTemplate)
b2CalculateBodyMass body(n, 0)
if n > 1 then b2setbodyposition body(n, 0), 512 + rnd(9216), -352 + rnd(736)
next n
for n = 1 to 150
star(n) = b2createdynamicbody(world, 0, 0, 0, 0, 0, 0)
shape = b2createcircleshape(star(n), 0, 0, 2, 0.01, 2, 0)
b2calculatebodymass star(n)
b2setbodyposition star(n), 512 + rnd(9216), -352 + rnd(736)
next n
b2setworlddebug world, 1
offx = screen width()/2
offy = screen height()/2
b2SetDebugTransform offx, offy, 1, 1 `0.25, 0.25
`b2SetDebugFlags 1, 1, 1, 1, 1, 1, 1
b2SetDebugFlags 1, 0, 0, 0, 1, 0, 0
b2setcontactlistener get ptr to function("b2listen")
global score = 0
do
dec offx, 3
b2SetDebugTransform offx, offy, 1, 1 `0.25, 0.25
b2setbodylinearvelocity body(1), b2getbodylinearvelocityx(body(1))/1.5, b2getbodylinearvelocityy(body(1))/1.5
b2bodyapplyimpulse body(1), 0, 0, (mousex() - (offx + b2getbodypositionx(body(1))))*2.0, (mousey() - (offy + b2getbodypositiony(body(1))))*2.0
line mousex(), mousey(), offx + b2getbodypositionx(body(1)), offy + b2getbodypositiony(body(1))
b2worldstep world,2
for n = 1 to 150
if star(n) <> 0
b2setbodylinearvelocity star(n), b2getbodylinearvelocityx(star(n))/1.05, b2getbodylinearvelocityy(star(n))/1.05
if offx + b2getbodypositionx(star(n)) < 0
`b2deletebody star(n)
b2setbodyposition star(n), b2getbodypositionx(star(n)) + screen width() + 64, b2getbodypositiony(star(n))
`star(n) = 0
endif
if offx + b2getbodypositionx(star(n)) > screen width() and b2getbodylinearvelocityx(star(n)) > 0.1 then b2setbodyposition star(n), b2getbodypositionx(star(n)) - screen width() - 64, b2getbodypositiony(star(n))
if offy + b2getbodypositiony(star(n)) < 0 then b2setbodyposition star(n), b2getbodypositionx(star(n)), b2getbodypositiony(star(n)) + screen height() + 64
if offy + b2getbodypositiony(star(n)) > screen height() then b2setbodyposition star(n), b2getbodypositionx(star(n)), b2getbodypositiony(star(n)) - screen height() - 64
endif
next n
print score
sync
cls 0
loop
function b2listen(ContactPoint, Event)
shapea as double integer : shapea = b2getcontactpointshapea(ContactPoint)
shapeb as double integer : shapeb = b2getcontactpointshapeb(ContactPoint)
if shapea = body(1, 1) or shapeb = body(1, 1) then inc score
endfunction
(please forgive the tattiness

) This works ok, but if I uncomment line 32 to add the polygon (with or without commenting out lines 25 and 26), the body doesn't move, it just... sits there. It still responds to gravity though. Am I missing a special command to fix it up or just plain doing it wrong?
Qu No 2: For
this game I'm making I want to use Box2D polygons for foreground collision. Obviously I can't make huge concave shapes for each chunk of floor or ceiling

so I figured this: If in my editor I can, for an area
like this (I rushed D: ), create a silly shape for collision
like so, I can then "export" the level to a playable version where amongst all the other going-ons the shape has been triangulated (I figured it out today, go me... D: ) to give something
like this, where all these triangles are then stored as individual shapes which on level-init are created as box2d polygon shapes and assigned to a static body to, all-in-all, represent the collision area.
So, um, does this sound feasible to you? Would having all these shapes in a body, and then all these bodies in a level cause crashes, show-stopper slowdowns, etc.?
Thanks for putting up with me!