Proposed projects for inclusion with Codea 2.0 as learning projects

@dave1707 - just adjust the code in each tab as it stands, with no mods for fullscreen or portrait.

The grid is easy (2000x2000 is plenty), Restart can be made to happen less often, Menu is me getting over-enthusiastic about locals.

The joint is probably where I wouldn’t know, I haven’t worked with them.

@Ignatz One thing I noticed when going from one physics example to another, some of the physics bodies are left over and sometimes interfere with the current program. An example was going from 21 Rotate to 19 Collision. The letters bounce off an invisible floor.

@Zoyt the music one is hard to demo because the assets need to be downloaded before you can use the example. Perhaps that could be explained in the comments though. Location I’d like to demo but I imagine few people have GPS in their iPad, so it would need to be explained.

@Simeon, if a music pack is not downloaded and you attempt to play a track from it, what happens? Will it cause an error, or simply not play

Were any new example projects included with Codea 2.0?

@Simeon - What if I made it download StackIt’s theme song (or anything) with an HTTP request? Would that do?

@JakAttak no new projects, I want to start getting rid of some old ones (noise, cloth simulation). If it hasn’t been downloaded it acts as if you are trying to play a track that doesn’t exist.

@Zoyt that’s a thought, I’m unsure how that would work exactly — it might not be possible to play the downloaded data easily. I think maybe just explaining in the comments what to do might be best.

@Simeon - Alright. I’ll add a safeguard to tell the user they need to download it if the file doesn’t exist.

@Zoyt - why not download it the first time the program is run? I have code to do this with images

@Ignatz Here’s another program I found in my junk that might work for the demos. I even commented it for you. You swipe the screen to control the direction and speed of the circle. Also, I went thru your list of demo code and I made correction to 7 of mine so they show better in landscape mode with the output pane showing. I left all of the comments as is so you’ll just have to replace the old code with the new code. I’ll be sending you the new code soon.


displayMode(FULLSCREEN)

function setup()
    speed=30    -- set initial speed value
    swipe=vec3(0,0,0)    -- initialize swipe variable
    x=WIDTH/2    -- starting x location
    y=HEIGHT/2   -- starting y location
end

function draw()
    background(40,40,50)    -- set background color
    fill(255)    -- white color for circle
    text("Swipe for direction, length for speed",WIDTH/2,HEIGHT-100)
    ellipse(x,y,40)    -- draw a circle at x,y with size of 40
    if swipe.z>0 then    -- check if a swipe occured
        x=x+swipe.x*swipe.z    -- add x swipe speed to x value
        y=y+swipe.y*swipe.z    -- add y swipe speed to y value
    end  
end

function touched(t)
    if t.state==BEGAN then    -- start of swipe
        ts=vec2(t.x,t.y)    -- save touch start values
    end
    if t.state==ENDED then    -- end of swipe
        d=vec2(t.x,t.y):dist(vec2(ts.x,ts.y))    -- calculate swipe distance
        td=vec2(t.x-ts.x,t.y-ts.y):normalize()    -- x,y movement
        swipe=vec3(td.x,td.y,d/speed)    -- set swipe variable x,y,speed
    end       
end