Welcome to TerraDestructa
TerraDestructa is a grid based destroyable terrain system for corona.
This is the first release and should be considered an alpha. I do not think it's ready for a production app quite yet. That's your warning.
However it's quite fun to play with and the included main.lua demos the main feature
Just touch the squares to carve them away, the physics objects generate on the fly as you draw. All edges have physics. Carve the floor out under the balls to make them fall.
TerraDestructa is an origional work by Brad Herman
Copyright 2012
This code is released under the Creative Commons license
Attribution + Noncommercial (by-nc)
It's free to use for Noncommercial projects, if you want to add this library to a paid app
you need to buy a licence from me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | main = display.newGroup ( ) movingObjects = display.newGroup ( ) -- This group gets your objects you want to be moving behind the terrain local terra = require("terra") -- load the lib terra.bounce = .8 -- set the bounce phyiscs of the terrain, friction and density also work terra.newTerrain(0,40,32,44,10,10,"rect") -- args are top left x, top left y,grid width, grid height,pixel size of grid width ,pixel size height , eventually this will take an image, right now it expects "rect" -- we setup some groups to do our background removal with live masking, this part is slow on hardware right now, lots of room to make it faster. main:insert( background ) main:insert( terra.displayGroupFG ) main:insert( movingObjects ) main:insert( terra.displayGroup ) -- this is required Runtime:addEventListener ("enterFrame",terra.enterFrameProcess) --this event processes our terrain each frame |
ToDo list:
after i figured out it's use - its pretty cool.
Try clicking the square that keeps the circles at the top, destroying the area but kind of like making a tunnel where the objects can fall through.
Larry
www.DoubleSlashDesign.com