Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Box2D Gideros code - Gideros Forum

Box2D Gideros code

MillerszoneMillerszone Member
edited October 2011 in General questions
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

  • atilimatilim Maintainer
    Yes, you're right. I totally agree.

    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 :)
  • That would be good to have a choice between direct or layered Box2D API physics.
    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. :)
  • atilimatilim Maintainer
    Absolutely, also using direct Box2D API can be more flexible and fun. (e.g. for those coming from flash and cocos2d)

    I'm going to take a break this weekend, so no questions for a couple of days. :)
    :-D have a good weekend
  • The physics side of things is holding me back a bit. (too used to the competitors way of doing things) Then again when your head feels like it is stuffed full of jelly it doesn't help. ;)


    What would you do for your other half?

    http://www.sharksoupstudios.com
Sign In or Register to comment.