I’m trying to get a pinch to zoom out thing happening for my game, but need the physics objects to scale as well so game play can continue normally. Straight out I’ll say that if anybody has a better way of doing it then how I am, feel free to suggest it.
At the moment I’m using a varied version of this:
http://developer.coronalabs.com/forum/2011/12/27/can-physic-objects-scale
This works well when I feed a single physics shape into it, however what I want to do is pass a display group into it and have everything scale in the one call. The visual side of passing the group works fine, but obviously the group doesn’t reference the individual objects physics shape. The forum post uses a ‘self.bodyShape’ which I can’t get working or find reference to in the API’s.
So my workaround idea was to create a table with the individual shape variables in it, like this:
-- SHAPE VARIABLES
local shapeVariables = {}
shapeVariables ["ground1Shape"] = { -325,-52, 325,-52, 325,18, -325,18 }
shapeVariables ["ground2Shape"] = { -650,-52, 650,-52, 650,18, -650,18 }
except that there’s a total of 18 shapes.
So I’m tying now to call an array within an array and it won’t play nice. Even down to a basic level of
print(#shapeVariables)
returns 0, not nil, but 0.
In theory I’d like to do:
for i=1,#shapeVariables.?????? do
local child = shapeVariables[i]
-- multiply the shape by the object's new scale
local shape = child
shape = shape \* scale
end
But I can’t get my brain around it. Any suggestions? [import]uid: 157954 topic_id: 32280 reply_id: 332280[/import]
