@dave1707 hmm… Well, I’ve replaced the standing footwork on my player to use linearImpulse which seems to produce much less erratic behaviour when the frame rate dips. I’ll try get a comparable result, as you may notice applyForce(vec2(0,100)) is much much weaker than applyLinearImpulse(vec2(0,100)). Impulse isn’t an averaging force so try reducing the input in linearImpulse.
Thanks @dave1707 and @Luatee for giving those things a test. The next build has an exciting little feature relating to browsing the forums within the app.
@Luatee You might have to give “mass” some value to get equal results for applyLinearImpulse.
@Simeon results are close:
-- ApplyImpulse
-- Use this function to perform your initial setup
function setup()
held = nil
hang = nil
hpd = nil
ball = physics.body(CIRCLE,75)
ball.x = WIDTH/2
ball.y = 300
floor = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
box2 = physics.body(POLYGON,vec2(-150,-50),vec2(-150,50),vec2(150,50),vec2(150,-50))
box2.type = STATIC
box2.x = WIDTH-200
box2.y = HEIGHT-250
box3 = physics.body(POLYGON,vec2(-20,-120),vec2(-20,120),vec2(20,120),vec2(20,-120))
box3.type = DYNAMIC
box3.x = WIDTH-150
box3.y = HEIGHT-395
b3anc = box3.position+vec2(0,115)
b3pd = vec2(0,115)
nc = physics.joint(ROPE,box3,box2,box3.position,box2.position,math.huge)
physics.iterations(5,4)
end
function touched(t)
local p = vec2(t.x,t.y)
if t.state == BEGAN and ball:testPoint(p) then
held = p
hang = ball.angle
hpd = (p-ball.position)
end
if t.state == MOVING and held then
held = p
end
if t.state == ENDED then
held = nil
hang = nil
hpd = nil
end
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(2)
-- Do your drawing here
pushMatrix()
pushStyle()
translate(ball.x,ball.y)
rotate(ball.angle)
sprite("Space Art:UFO",0,0,150,150)
popStyle()
popMatrix()
sprite("Cargo Bot:Game Area Floor",box2.x,box2.y,300,100)
pushMatrix()
pushStyle()
translate(box3.x,box3.y)
rotate(box3.angle)
sprite("Space Art:Icon",0,0,40,240)
popStyle()
popMatrix()
if held then
local pos = (ball.position+(hpd):rotate(math.rad(ball.angle-hang)))
ball:applyLinearImpulse(ball.mass*((held-pos)*32-ball.linearVelocity)/32,pos)
fill(255)
ellipse(pos.x,pos.y,15)
end
pos = (box3.position+(b3pd):rotate(math.rad(box3.angle)))
box3:applyForce(box3.mass*((b3anc-pos)*32-box3.linearVelocity),pos)
fill(50,200,50,255)
ellipse(pos.x,pos.y,15)
end
You can make ‘stiff’ joints, trying to figure a way to make it a bit more axis like.
Edit: Codea crashed after I opened it back up from multitask screen and pressed X to edit the editor, not sure if thats related to the fix in (29). I can’t recreate it though so maybe not.
New build is out which removes the triple-tap escape gesture in favour of closing-and-reopening Codea. Also disables the swipe back gesture.
Also try browsing the forums from the Codea Talk button on the main screen, I’ve made it easier to copy blocks of code when on the iPad.
@Simeon When in FULLSCREEN no buttons, the buttons can be brought back with a slight 4 finger squeeze and release.
@Simeon I ran into a problem where I couldn’t get out of the fullscreen no buttons unless I killed Codea and reopened it. The slight 4 finger squeeze didn’t work. The full 4 finger squeeze and reopen Codea didn’t work. Pressing the home button and opening Codea didn’t work. I had to kill Codea before it was back to normal.
@dave1707 hmm odd, must be a bug in my code. From the app’s point of view the multi-touch squeeze is identical to hitting the home button and reopening the app.
@Simeon Here’s the steps to recreate the fullscreen no buttons problem.
1. start a program with fullscreen no buttons
2. press the home button
3. press the Codea icon to bring the program back.
It should show the buttons.
4. slide your finger from the left side to the right to show half the editor screen.
slide the screen back to the left.
5. press the replay button.
6. at this point, you can't get the buttons back.
Been playing with the new speech api - so far so good and nothing erroneous to report thus far and nicely implemented!
I noticed that most of the functionality is documented, apart from: speech.voice - which appears to be exposed, but with no info what it does. What does this do?
I’m having some problems with zDepth (not specific to the latest beta), probably because I was using a vertex shader to make waves. It seems to be reversed, as seen in this picture:
(using setContext with depth)
Any ideas on how to fix this, if it is because I’m using a shader that moved some vertices higher than OpenGL thinks they are?
@andymac3d thanks! speech.voice is reserved for the future. There is the potential to change the voices but an API is not yet worked out for that.
@SkyTheCoder I’m unsure what you are experiencing from the picture, any more details?
@Simeon The water in the background is showing up over the water in the foreground.
Thanks for details @SkyTheCoder, it would be best to try to isolate this in a simplified test case.
Out of curiosity, has anyone noticed the “COPY” option next to code blocks when the forum is browsed within Codea? Are these useful for you?
@Simeon So that’s where is was hiding. I gave it a try and it makes copying code a lot easier. Don’t have to struggle with the drag icons on larger chunks of code. Works great.
@Simeon When using the forum from within Codea, could you add another icon at the bottom of the screen where you have the reload and open in Safari icons. One that would cause a jump to the top of the discussion. On long discussions, it takes awhile to scroll back to the top. In the normal forum, tapping the screen at the very top next to the battery icon causes the screen to jump to the top of the discussion.
@Simeon Forget about adding the icon mentioned above. I didn’t notice the “Home Beta” buttons at the left side of the screen. The Home button does what I was asking.
@dave1707 I added a status bar to the in-app browser which you should be able to tap to scroll to top.
@Simeon Loaded Codea 2.2(31) and tried the fullscreen no buttons problem and couldn’t get it to fail, looks like it’s fixed. Tried the status bar in the in-app browser and it scrolls to the top, thanks. Not sure what the other updates did. Doesn’t sound like anything I ever used, so I can’t report on them.
@dave1707 thanks! The other stuff is just the necessary parts before App Store release, I think build 31 is a good release candidate.