i’ve been trying to find a way to make a ragdoll and set the joints pretty much automatically - meaning at the intersection of the two parts.
for this I’ve scratched my head for hours trying to understand the code in the ragdoll sample provided by Corona sdk.
-
why do they set a local variable w and h (width and height) to set the newRect ? I assume that’s because they want to reuse it for the other leg. ok. but why declare it 2 * 7.5 why not 15 ?
-
why use -w * 0.5 for the x position of newRect ?
-
why then move the leg with the translate api to StartX -8
-
i am quite puzzled about the coding, is that a reason behind all this that we should all adopt when coding similar things or was it just some programmer trying to look fancy ?
– UpperLeg
local w,h = 2*7.5,2*22
– L
local upperLegL = display.newRect( -w*0.5, -h*0.5, w, h )
upperLegL:translate( (startX - 8), (startY + 85) )
setFill(upperLegL, colorTable)
ragdoll:insert (upperLegL)
Corona, help please !
thanks
Edualc