I first started using Codea this weekend, got a basic physics scene with floor, 2 walls and a ball jumping inside it.
Exported the thing to XCode using the “Export to Dropbox” option.
When I open the project in XCode and try to launch it in the iPad or iPhone simulator it throws an Error and the app does not start.
It says something about SIGABRT.
Im currently at work so you can ask me for more info about this and will provide it as I get back to my macbook.
Is there any known issue with this feature? Something Im missing?
@nsxNawe The export routine certainly does work (@akaJag, the runtime isn’t needed for the native export) so it might be an issue with your code. Could you post it for experimenting?
Thank you guys, @akaJag, I had that doubt too about the Codea Runtime Library, so @Andrew_Stacey you just cleared that up for the two of us :P.
My own lua code is just a single Main class.
I just tried posting the code but the forum formatter did not take line breaks so it was very ugly.
Instead, here is a link to the exported zip project. https://dl.dropboxusercontent.com/u/9496873/HelloWorldphysics.zip
So that is exactly the same I used to pull up a project on XCode.
Code can be displayed between triple tildes: ~~~ see the FAQ for details. Here’s your code:
-- Hello World physics
-- Use this function to perform your initial setup
function setup()
-- Floor and walls
w1 = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
w2 = physics.body(EDGE,vec2(0,0),vec2(0,WIDTH))
w3 = physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT))
-- Ball
ball_diam = 60
-- The physics object for the ball
p_ball = physics.body(CIRCLE,ball_diam/2)
-- Apply gravity
p_ball.gravityScale = 1
-- Bounciness, lower for less
p_ball.restitution = .8
-- Now friction, if a table surface we set it from 0 and 1
p_ball.friction = 0
-- Velocity in pixels per second
p_ball.linearVelocity = vec2(math.random(400),math.random(400))
-- Position randomly on screen
p_ball.x = math.random(60,250)
p_ball.y = math.random(400,600)
end
function draw()
background(200,200,200,255)
-- Draw the ball
-- style
pushStyle()
fill(255,0,0,255)
ellipse(p_ball.x,p_ball.y,ball_diam)
popStyle()
end
Sometimes export does not include libraries and libcodea.a and libtools.a are missing in Libs folder. I have exported some other project (CargoBot) and copied both files in my project Libs folder.