Today I was checking out the physics example "Collision Detection", the scene with
two falling boxes. Well, I compared Gideros box scene to Competitors box scene
example and noticed there was more code needed for the Gideros physics box scene.
Note: I removed...world:addEventListener(Event.BEGIN_CONTACT, onBeginContact)
world:addEventListener(Event.END_CONTACT, onEndContact)
world:addEventListener(Event.PRE_SOLVE, onPreSolve)
world:addEventListener(Event.POST_SOLVE, onPostSolve)
and the functions, but still needed more extra code.
For me it's not much of a problem, but for a beginner, the less code the better.
Thanks again.
Competitors box physics scene:
local physics = require( "physics" )
physics.start()
local sky = display.newImage( "bkg_clouds.png" )
sky.x = 160; sky.y = 195
local ground = display.newImage( "ground.png" )
ground.x = 160; ground.y = 445
physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } )
local crate = display.newImage( "crate.png" )
crate.x = 180; crate.y = -50; crate.rotation = 5
physics.addBody( crate, { density=3.0, friction=0.5, bounce=0.3 } ) |
Comments
Currently, we have two goals about physics. First, we want to bind all functions of Box2D to Lua. And second we will put an extra layer on top of that for easy physics programming. We want to allow programmers to choose between direct Box2D API or easy physics API.
Thank you
If your game has a lot going on, then you can use direct Box2D for speed, or if your game is
simple, then you can choose layered Box2D.
I'm going to take a break this weekend, so no questions for a couple of days.
http://www.sharksoupstudios.com