# 2D Physic game / sandbox with drawing

Hi, i was working in this prototype:

The source code is here:

https://gist.github.com/3155875

I was wondering if we could use brushes like crayon in stead of solid lines…what do you think?

That’s really neat! I’m gonna grab it and try it now!

blimey - that is very impressive!

I quit

Looks like a lot of fun. Loved the video.

Hey!, thank you everypeople! I’m glad you liked…
Well, i’m studying all this new physic stuff in Codea, and I missed some things from the original Box2D, I would need a Rope Joint…

For example, for a bridge I am using a for loop that builds n bodies and n-1 DISTANT joints, the first and the last bodies I set them to STATIC , so you have a very good looking wood bridge XD

But for the rope physics…that’s another topic!

See:

section 8.13. Rope Joint… if you implement this, you can have a “Countre Jour” like game in a few hours…well, I know the rope joint is a relatively new addition to Box2D, so, you can addapt this code:

Elastic ropes could be used also for fluid dinamycs simulations…
what do you say people?

@juaxix, are you a genius or what? ^:)^ Great things you make (I’m stuck for the moment trying to figure out how to produce physical bodies from an emitter, like drops from a nozzle for example b-( ). Interesting idea about using elastic ropes for fluid dynamics simulations… I would like to know more about your idea, if possible
Saludos ~O)

@juaxix
I totally forgot but the ROPE joint should already be in there, I just forgot to document it.

The syntax is:

``````rope = physics.joint(ROPE, bodyA, bodyB, anchorA, anchorB, length)
``````

I used it for this example to do the chain for the vehicle. I actually used one rope joint and a bunch of revolute joints to give the impression of realistic chain movement.

Here’s a link to the code on gist: https://gist.github.com/3167310
Check out the SlammerPod class to see how it works.

Thank you very much @John !!, that is exactly what i was looking for

I was playing around with this rope but i would like to create a rope like cut the rope, i think it could be made with circles connected with rope joints and filter by category and masks the behaviour of the bodies like you do with the rectangles in your character metal string of rings, but if i want a thing like a pulley!

I realized there is no PULLEY joint, following the box2d manual we stop at ROPE.
I’m figuring how to build a pulley with distant, prismatic and rope joints…let’s see where it goes

Meanwhile I have invented a simple orbit physics with a main static planet applying forces to the bodies around it, take a look:

Code:

``````    local x,y = self.base.position.x, self.base.position.y
for _,b in ipairs (debugDraw.bodies) do
if b.type == DYNAMIC then
local grav = vec2(x-b.position.x,y-b.position.y)/2
b:applyForce(grav)
end
end
``````

Video :

http://yfrog.us/5g8p6kvyhwbvrogpahjixscrz

A very cool development, @juaxix!

Wow… This is amazing. Looking forward to it’s release!

Thanks all , i am studying water physics and ropes, pulleys, etc, this part is hard, specially when you are ill and have fevers xD

Just wanna let here the latest art (3+ months ago)