I have a game where a character runs down a slope, so I have made a table to create the objects for the slope. However,I was wondering whether it would be possible to generate the slope as the character goes along, rather than generating it all at the beginning. Also, would it be possible to remove the objects once the character has run past them? The code I am currently using is:
local slope = {}
slopeshape = { -240,-100, 240,100, -240,100 }
local function MakeBottom()
for s = 1,30 do
slope[s] = display.newImage("slope.png")
physics.addBody(slope[s], "static", {friction=0.01, density = 1, bounce = 0.1, shape=slopeshape})
slope[s]:setReferencePoint(display.TopLeftReferencePoint)
slope[s].x = (s\*468) - 480
slope[s].y = (s\*195) - 100
slope[s].material = "ground"
moveGroup:insert(slope[s])
end
end
MakeBottom()
[import]uid: 116264 topic_id: 24349 reply_id: 324349[/import]