50 Line Challenge

edited December 2013 in Competition Posts: 835

The challenge is as the name implies, You have 50 lines of Code to make something. There are some rules though:
1) Dependencies can be used, but the Main File + The dependancy must equal 50 lines all together.
2) Must be original, No Copying and Pasting old projects(Inspirations and loosely based are allowed)
3) Must be written in Codea/Lua
4) Post your entries on this thread
5) Have Fun!!!
EDIT Comments do not count as lines

«1

Comments

  • Well I bet I can do it in 1 line xD

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Can http be used ? >:)

  • edited December 2013 Posts: 577
    function setup()
    print("A word a day, keeps the spelling teacher away!")
    texta = ""
    end
    
    function draw()
    showKeyboard()
    texta = keyboardBuffer()
    text(texta,WIDTH/2,HEIGHT/2)
    end
    
    function keyboard(k)
    if k == RETURN then
    
    openURL('http://www.wordhippo.com/what-is/another-word-for/' ..texta.. '.html')
    end
    end
    

    Boom. Do I win?

  • Here's my entry :')

    http://pastebin.com/Zj3kxXF0

  • Posts: 2,820

    Yup, there's the flaw I was talking about @stevon8ter .

  • edited December 2013 Posts: 547

    What flaw? My code is flawless :')

    What did I win ? :D

    jk peops, I'll try to come up with a real idea soon

  • BriarfoxBriarfox Mod
    Posts: 1,542

    I was just going to have a single http.request and a loadstring :P

  • edited December 2013 Posts: 547

    Ok here you go, it needs a while to start up and doesn't use the best methods because of the limited lines of code, tho I still got 7 lines left... I'll try to finish the rest of the program with those lines, tho it won't be easy

    function setup()
        displayMode(FULLSCREEN)
        fontSize(12)
        data = {packs = {"Documents", "Dropbox", "Cargo Bot", "Planet Cute", "Platformer Art", "Small World", "Space Art", "SpaceCute", "Tyrian Remastered"}, pos = vec2(WIDTH/2, HEIGHT/2), packselect = image(WIDTH, 121), selected = 1, selectpos = vec2(WIDTH/2,HEIGHT/2 - 121), packks = {}, imgs = {}}
        for i = 1, #data.packs do
            setContext(data.packselect)
            if readImage(data.packs[i] .. ':Icon') then
                sprite(data.packs[i] .. ':Icon', (i-1)*105 + 55, 121-55, 100, 100)
            else
                sprite("Cargo Bot:Crate Blue 1", (i-1)*105 + 55, 121-55, 100, 100)
            end
            text(data.packs[i], (i-1)*105 + 55, 121 - 55 - 60)
            data.packks[i] = {}
            for e = 1, math.ceil(#spriteList(data.packs[i])/9) do
                data.packks[i][e] = image(9*105, 121)
            end
            for e = 1, #spriteList(data.packs[i]) do
                setContext(data.packks[i][math.ceil(e/9)])
                a = readImage(data.packs[i] .. ':' .. spriteList(data.packs[i])[e])
                if a then
                sprite(a, (e-1)%9*105 + 55, 121-55, 100, 100)
                text(spriteList(data.packs[i])[e], (e-1)%9*105 + 55, 121 - 55 - 60)
                end
            end
        end
        setContext()
    end
    function draw()
        background(255, 255, 255, 255)
        sprite(data.packselect, data.pos.x, data.pos.y)
        for i = 1, #data.packks[data.selected] do
            sprite(data.packks[data.selected][i], data.selectpos.x + (i-1)*(9*105), data.selectpos.y)
        end
    end
    function touched(t)
        for i = 1, #data.packs do
            if t.x <= data.pos.x - WIDTH/2 + i*105 and t.x >= data.pos.x - WIDTH/2 + (i-1)*105 + 5 and t.y <= data.pos.y + 55.5 and t.y >= data.pos.y - 44.5 then
                data.selected = i
                data.selectpos = vec2(WIDTH/2, HEIGHT/2 - 121)
            end
        end
        data.selectpos.x = data.selectpos.x + t.deltaX
    end
    
  • edited December 2013 Posts: 2,042

    @Prynok, yours doesn't work because openURL needs a http:// in the address.

    Here is mine (I used exactly 50 lines):

    function setup()
        print("A word a day, keeps the spelling teacher away!\n\nPowered by WordHippo.")
    
        wordSynonyms = {}
    
        parameter.text("WORD", "Word", function() WORD = string.lower(WORD) end)
        parameter.action("Find Synonyms", loadSynonyms)
        parameter.action("See The Website", openSynonymsPage)
    end
    
    function openSynonymsPage()
        openURL('http://www.wordhippo.com/what-is/another-word-for/' .. WORD .. '.html', true)
    end
    
    function loadSynonyms()
        local gotData = function(data, status, headers)
            wordSynonyms = {}
    
            for word in data:gmatch('.html">(.-)</a>') do
                table.insert(wordSynonyms, word)
            end
    
            local fix = nil
            if #wordSynonyms == 1 then 
                fix = "No synonyms found."
            end
            for id, word in ipairs(wordSynonyms) do
                if word == "Meaning of the word " .. WORD then
                    wordSynonyms[id] = fix
                end
            end
        end
    
        http.request("http://www.wordhippo.com/what-is/another-word-for/" .. WORD .. ".html", gotData)
    end
    
    function draw()
        background(0)
        fontSize(20) fill(255)
    
        local cols = 3
        for id, word in ipairs(wordSynonyms) do
            local row = math.ceil(id / cols)
            local col = math.ceil(id - ((row - 1) * cols))
            local y = HEIGHT - (fontSize()*2 * row)
            local x = WIDTH * (col / 4)
    
            text(word, x, y)
        end
    end
    
  • Posts: 577

    @JakAttack Oops! Fixed.

  • Thinking I did so much trouble getting my code under 50 lines to see so much space left in your program xd
    I couldn't think of a better idea :s

  • SimeonSimeon Admin Mod
    Posts: 5,054

    Here's my 50 line entry. (Cheating a bit by sticking multiple statements on one line at times).

    A game where you drag the balloons to keep them below the line. High score is how long you lasted.

    function setup()
        balloons = {}; interacting = {}; spawnInterval = 5; ended = false
        displayMode(FULLSCREEN); state = "Keep the balloons below the line!"
    end
     
    function draw()
        local mr = math.random
        noStroke(); background(60, 60, 87, 255)
        for k,b in pairs(balloons) do
            b.pos = vec2(b.init + math.sin(b.pos.y * 0.035) * 30, b.pos.y + b.speed)
            b.speed = b.speed + 0.003
            if b.pos.y > (HEIGHT - 250) and not ended then 
                ended=true; state="You lasted: ".. math.floor(ElapsedTime) .." seconds" 
            end
            math.randomseed(b.init)
            fill(185+mr(80),50+mr(40),50+mr(40))
            ellipse(b.pos.x, b.pos.y, 100)
        end
        for k,b in pairs(interacting) do
            fill(255) ellipse(b.pos.x,b.pos.y,105) end
        if spawnInterval * #balloons < ElapsedTime then
            local xp = mr(WIDTH - 100) + 50
            table.insert( balloons, { pos=vec2(xp, -50), init=xp, speed=1 } )        
        end
        fill(255); fontSize(40); text(state,WIDTH/2,HEIGHT - 100)
        strokeWidth(5); line(0,HEIGHT - 200,WIDTH, HEIGHT - 200)
    end
     
    function touched(touch)
        if touch.state == BEGAN then
            local closest = nil; local closestDist = math.huge
            for k,b in pairs(balloons) do
                if b.pos:distSqr(vec2(touch.x,touch.y)) < closestDist then
                    closestDist = b.pos:distSqr(vec2(touch.x,touch.y))
                    closest = { k, b }
                end
            end
            if closest then 
                interacting[touch.id] = closest[2] 
                balloons[closest[1]] = nil
            end
        elseif touch.state == MOVING then
            local b = interacting[touch.id]
            b.pos.y = b.pos.y + touch.deltaY
            b.pos.x = b.init + math.sin(b.pos.y * 0.035) * 30
        elseif touch.state == ENDED or touch.state == CANCELLED then
            table.insert(balloons, interacting[touch.id])
            interacting[touch.id] = nil
        end
    end
  • edited December 2013 Posts: 547

    @Simeon, that's amazing with such few lines :o tho I quickly see you left 3 lines open ;)

    but here's a version that doesn't include multiple statements on 1 line, sorry I just had to do it xD

    still Simeon's code tho, just changed the balloons to be heart-shaped
    and some other things as defining multiple vars in 1 statement (not in multiple statements as simeon did) and I had to remove some 'locals'

    function setup()
        balloons, interacting, spawnInterval, ended, state = {}, {}, 5, false, "Keep the balloons below the line!"
        displayMode(FULLSCREEN)
    end
    function draw()
        noStroke()
        background(60, 60, 87, 255)
        for k,b in pairs(balloons) do
            b.pos = vec2(b.init + math.sin(b.pos.y * 0.035) * 30, b.pos.y + b.speed)
            b.speed = b.speed + 0.003
            if b.pos.y > (HEIGHT - 250) and not ended then
                ended = true
                state="You lasted: ".. math.floor(ElapsedTime) .." seconds" 
            end
            sprite("Planet Cute:Heart", b.pos.x, b.pos.y, 100, 150)
        end
        for k,b in pairs(interacting) do
            sprite("SpaceCute:Health Heart", b.pos.x, b.pos.y, 100, 100)
        end
        if spawnInterval * #balloons < ElapsedTime then
            table.insert( balloons, { pos=vec2(math.random(WIDTH - 100) + 50, -50), init=math.random(WIDTH - 100) + 50, speed=1 } )        
        end
        fill(255)
        fontSize(40)
        text(state,WIDTH/2,HEIGHT - 100)
        strokeWidth(5)
        line(0,HEIGHT - 200,WIDTH, HEIGHT - 200)
    end
    function touched(touch)
        if touch.state == BEGAN then
            closest, closestDist = nil, math.huge
            for k,b in pairs(balloons) do
                if b.pos:distSqr(vec2(touch.x,touch.y)) < closestDist then
                    closestDist = b.pos:distSqr(vec2(touch.x,touch.y))
                    closest = { k, b }
                end
            end
            if closest then 
                interacting[touch.id] = closest[2] 
                balloons[closest[1]] = nil
            end
        elseif touch.state == MOVING then
            local b = interacting[touch.id]
            b.pos.y = b.pos.y + touch.deltaY
            b.pos.x = b.init + math.sin(b.pos.y * 0.035) * 30
        elseif touch.state == ENDED or touch.state == CANCELLED then
            table.insert(balloons, interacting[touch.id])
            interacting[touch.id] = nil
        end
    end
    
  • JohnJohn Admin Mod
    edited December 2013 Posts: 579

    Here's my entry. The code has horrible variable names for no other reason than me being too lazy to type longer ones.

    displayMode(FULLSCREEN)   
    function setup()
        man, blobs = {r = 0, d = 100, steer = 0, t = 0, rad = 10, score = 0}, {}
        ellipseMode(CENTER)
        fontSize(20)
    end
    function draw()
        background(0, 0, 0, 255)    
        text("SCORE: " .. man.score .. " " .. #blobs, WIDTH/2, HEIGHT - 20)  
        man.r = man.r + man.steer * DeltaTime * math.pi * 1.25
        local j = math.random() * 2
        local manPos = vec2(WIDTH/2 + math.cos(man.r) * (man.d+j), HEIGHT/2 + math.sin(man.r) * (man.d+j))
        fill(255, 0, 204, 255)
        ellipse(manPos.x, manPos.y, man.rad * 2)
        man.t = man.t - DeltaTime
        if man.t <= 0 then
            local d = math.sqrt(WIDTH/2*WIDTH/2 + HEIGHT/2*HEIGHT/2)
            table.insert(blobs, {r = math.random() * 2 * math.pi, d = d, rad = math.random(5, 40)})
            man.t = math.max(3 - ElapsedTime * 0.05, 0.2)
        end    
        fill((noise(1000+ElapsedTime/10)+1.5)*128, (noise(500+ElapsedTime/100)+1.5)*255, (noise(ElapsedTime/10)+1.5)*128, 255)
        ellipse(WIDTH/2, HEIGHT/2, math.abs(math.sin(ElapsedTime * 5)) * 5) 
        local dead = {}
        for k,blob in pairs(blobs) do
            local blobPos = vec2(WIDTH/2 + math.cos(blob.r) * blob.d, HEIGHT/2 + math.sin(blob.r) * blob.d)
            ellipse(blobPos.x, blobPos.y, blob.rad * 2)
            if blob.d >= 0 then blob.d = blob.d - DeltaTime * (200 - blob.rad * 2) * math.max(math.min(ElapsedTime/20, 3), 1)
                if manPos:dist(blobPos) < man.rad+blob.rad then
                    draw = function() 
                        background(0, 0, 0, 255)
                        text("GAME OVER: "..man.score, WIDTH/2, HEIGHT/2) 
                    end
                end
            elseif blob.rad > 0 then blob.rad = blob.rad - DeltaTime * 100 
            elseif not blob.dead then man.score = man.score + 1; blob.dead = true; table.insert(dead, k) end
        end
        for i = #dead,1,-1 do table.remove(blobs, dead[i]) end
    end
    function touched(touch)
        if touch.x < WIDTH/2 and touch.state == BEGAN then
            man.steer = man.steer + 1
        elseif touch.x < WIDTH/2 and touch.state == ENDED then
                man.steer = man.steer - 1
        elseif touch.x >= WIDTH/2 and touch.state == BEGAN then 
                man.steer = man.steer - 1
        elseif touch.x >= WIDTH/2 and touch.state == ENDED then
                man.steer = man.steer + 1
        end
    end
  • edited December 2013 Posts: 547

    Heey if we can do our for loops and if statements etc, in one full line, then I can make my code even smaller and maybe implement a full working sprite selector :p instead of just the sprite browser, but idk if that's allowed @codeanoob ..?

    @John that's amazing in just 50 lines :o
    And then to know you got a fully working game + nice game over screen, also, I think you can reduce it by at least 4 lines ;)

  • dave1707dave1707 Mod
    Posts: 7,809

    Here's my submission. I'm taking "one line" as what will fit on one line in portrait orientation (smallest width) without wrapping to another line. To play this game, tap the number you want to move to the blank square. Object is to get the numbers in order, left to right, top to bottom, with the blank square in the lower right corner.


    displayMode(FULLSCREEN) supportedOrientations(PORTRAIT_ANY) function setup()     count,size,done,ntab,otab=0,150,false,{},{}     tab = { {2,5,},{1,3,6,},{2,4,7,},{3,8,},{1,6,9,},{2,5,7,10,},     {3,6,8,11,},{4,7,12,},{5,10,13,},{6,9,11,14,},{7,10,12,15,},     {8,11,16,},{9,14,},{10,13,15,},{11,14,16,},{12,15,} }         create16() end function create16()    -- create starting puzzle     for z = 1,16 do ntab[z]=0 rnd = randomNbr() ntab[z]=rnd otab[z]=rnd     if rnd == 16 then n=z end end ntab[n]="" otab[n]="" end function randomNbr()     while 1 do a = math.random(1,16)     for z = 1,16 do if ntab[z] == 0 then return(a) end if ntab[z] == a then break      end end end end function draw()     background(40,40,50) offset=0 rectMode(CENTER) text("REPLAY",190,800)      text("NEW",600,800)      for y=4,1,-1 do for x=1,4 do offset = offset + 1     fill(200,0,0) rect(x*size,y*size,size,size)     fill(255) fontSize(60) text(ntab[offset],x*size,y*size) end end     if done then str=string.format("Complete   %3d",count)          text(str,WIDTH/2,HEIGHT-100) else              str=string.format("Number of moves   %3d",count)          text(str,WIDTH/2,HEIGHT-50) end end function touched(t)     if t.state==BEGAN then     if t.x>100 and t.x<300 and t.y>750 and t.y<850 then     for z=1,16 do ntab[z]=otab[z] end count=0 done=false end     if t.x>500 and t.x<700 and t.y>750 and t.y<850 then setup() end     if not done then z=0 for y=4,1,-1 do for x=1,4 do z = z + 1     if t.x > x*size-35 and t.x < x*size+35 then     if t.y > y*size-35 and t.y < y*size+35 then checkblank(z)      end end end end end end end function complete()    -- check for a completed game     count = count + 1 for z = 1,15 do if ntab[z] ~= z then return      end end done=true end function checkblank(pos)    -- check for the blank space      for z = 1,#tab[pos] do val = tab[pos][z]if ntab[val] == "" then      ntab[val] = ntab[pos]      ntab[pos] = "" complete() return end end end
  • omg guys stop being so good all entries other than mine just powned me so hard :o

  • Here's what I made:

    --GDC
    --CodeaNoob
    function setup()
        supportedOrientations(LANDSCAPE_ANY)
        saveProjectInfo("Description","50 Line Challenge Entry")
        saveProjectInfo("Author","CodeaNoob")
        readProjectInfo("Description")
        readProjectInfo("Author")
        print("Tap to open the Keyboard")
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        saveProjectData("Version#", 1.4)
        parameter.action("Help?",function()
            output.clear()
            print("GDC Help Guide\n\n1) Enter the desired Global Variable in the textbox\n\n2) Press Save as Global Data to have the data available to all your projects")
            print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
            end)
        parameter.text("GlobalVar","DefaultVar")
        parameter.action("Save as Global Data",function()
        saveGlobalData(GlobalVar,buffer)
        sound(DATA, "ZgBANgBAQD5AQEBAAAAAABC8UD1GWfU+ZABAf0BAQEBAQGpl")
        print("Saved as Global Variable: "..GlobalVar)
        print("Contents of "..GlobalVar..":\n"..buffer)
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        end)
            parameter.color("Background",0,0,0)
            parameter.color("Colour",0,255,0)
    end
    function draw()
        Time = os.date("%c")
        background(Background)
        fill(Colour)
        textMode(CORNER)
        buffer = keyboardBuffer()
    
        _,bufferHeight = textSize(buffer)
    
        if buffer then
            text( buffer, 10, HEIGHT - 30 - bufferHeight )
            text(Time,10,10)
            text("Version: Beta "..readProjectData("Version#"),10,30)
        end
    end
    function touched(touch)
        showKeyboard()
        end
    
  • Posts: 502

    Nice idea. Wanted to do a line animation. Draw several lines on the screen and animate between the line segments. Wanted to mess around with buffers, but didn't get it working, but anyway :)

    function setup()
        displayMode(FULLSCREEN)
        m, ps = mesh(), {}
    end
    
    function draw()
        background(0, 0, 0, 255)
        m:clear()
        for i,v in ipairs(ps) do
            m:addRect(v.x, v.y, v.d, 2, v.a)
        end
        m:draw()
    end
    
    function touched(touch)
        p = vec2(touch.x, touch.y)
        if touch.state == BEGAN then
            sp, i = p, 1
        elseif touch.state == ENDED or (sp-p):len() > 10 then
            addline(sp, p)
            sp = p
        end
        if touch.state == ENDED then
            for x=i,#ps do 
                tween(.5, ps[x], {d=0}, tween.easing.quadInOut)
            end
        end
    end
    
    function addline(a,b)
        local v = b - a
        local p = a + v*.5
        p = {x=p.x, y=p.y,d=v:len(),a=-v:angleBetween(vec2(1,0))}
        if ps[i] then
            tween(.6, ps[i], p, tween.easing.quadInOut)
        else
            table.insert(ps, p)
        end
        i = i + 1
    end
    
  • dave1707dave1707 Mod
    edited December 2013 Posts: 7,809

    Here's another submission. Again, I'm taking "one line" as what will fit on one line in portrait mode without wrapping. The object of this game it to make the squares either all red or all green. Tapping on a square will flip the square and the 4 adjacent squares, right, left, up, down to the opposite color. If all the squares are red or green, "Complete" will show on the screen.

    EDIT: I made an error in the code and reposted the correct code.


    displayMode(FULLSCREEN) function setup() fTab={{0,1},{-1,0},{0,0},{1,0},{0,-1}} tx,ty=0,0 tab={}      for x=1,8 do tab[x]={} for y=1,8 do tab[x][y]=false if math.random(100)<51 then      tab[x][y]=true end end end end function draw() background(40, 40, 50) for x=1,8 do for y=1,8 do fill(0,255,0)     if tab[x][y] then fill(255,0,0) end rect(x*70,y*70,65,65) end end     if checkAll() then text("Complete",WIDTH/2,HEIGHT-50) end end function flip() for a=1,5 do xx=tx+fTab[a][1] yy=ty+fTab[a][2]      if xx>0 and xx<9 and yy>0 and yy<9 then tab[xx][yy]=not tab[xx][yy] end end end function touched(t) if t.state==BEGAN then tx=math.floor(t.x/70)     ty=math.floor(t.y/70) flip() end end function checkAll() t=0 for x=1,8 do for y=1,8 do if tab[x][y] then t=t+1 end end end      if t==0 or t==64 then return true end return false end
  • @dave1707, Isn't this an app on the appstore as well?

  • dave1707dave1707 Mod
    Posts: 7,809

    @CodeaNoob Since I don't normally play games anymore, I don't look for them on the app store. It's a simple concept, so I'm sure there would be a lot of versions of it. It's just something that I remember from long ago. I had to repost a correct version of the code above because I was flipping too many squares when I first posted it.

  • edited December 2013 Posts: 1,255

    Some moderately ugliness in getting this < 50, but I'm pretty pleased with the line intersect (and now someone will tell me it's built into math lib).

    screenshot

    Trace a continuous line to collect jewels, but don't lift your finger or cross your line.

    My high score is 11

    function setup()
        displayMode(FULLSCREEN)
        lines = {}
        prize = nil
        score, state = 0
        fontSize(32)
    end
    
    function ccw(A,B,C) return (C.y-A.y)*(B.x-A.x) > (B.y-A.y)*(C.x-A.x) end
    
    function intersect(l1, l2)
        return ccw(vec2(l1.x, l1.y), vec2(l2.x, l2.y), vec2(l2.z, l2.w)) ~=
        ccw(vec2(l1.z, l1.w), vec2(l2.x, l2.y), vec2(l2.z, l2.w)) and
        ccw(vec2(l1.x, l1.y), vec2(l1.z, l1.w), vec2(l2.x, l2.y)) ~=
        ccw(vec2(l1.x, l1.y), vec2(l1.z, l1.w), vec2(l2.z, l2.w))
    end
    
    function linesIntersect()
        for h = 1, #lines do for j=h + 1, #lines do 
        if intersect(lines[h], lines[j]) and math.abs(h-j) > 2 then return true 
        end end end return false
    end
    
    function draw()
        background(40, 40, 50)
        if state == 1 then stroke(118, 146, 171, 255) else 
            text("Trace to treasure without crossing your line.", WIDTH/2, HEIGHT/2) 
            stroke(210, 27, 27, 255) 
        end
        strokeWidth(5)
        if #lines then for i, l in ipairs(lines) do line(l.x, l.y, l.z, l.w) end end
        if state == 1 then
            if not prize then prize = vec2(math.random(WIDTH-100)+50,
            math.random(HEIGHT-100)+50) elseif #lines > 0 then 
                if linesIntersect() then state= 4 return end
                sprite("Planet Cute:Gem Blue", prize.x, prize.y, 32)
                if math.abs(prize.x-lines[#lines].z) < 30 and
                math.abs(prize.y-lines[#lines].w) < 30 then score = score + 1 prize = nil
                end end end
        text(score, WIDTH/2, HEIGHT-30)
    end 
    
    function touched(touch)
        if touch.state == BEGAN then state = 1 lines = {} score=0
        elseif touch.state == MOVING then
            l = vec4(touch.prevX, touch.prevY, touch.x, touch.y)
            table.insert(lines, l)
        elseif touch.state == ENDED then state = 0 end
    end
    
  • toffertoffer Mod
    edited December 2013 Posts: 151

    My not very original and buged entry. I don't know if parameters were alowed, but that was fun to make :). Use the slider to play.

    local sub,rep = string.sub,string.rep
    local row = string.rep(" ",35)
    function setup()
        parameter.watch("PARAM_BREAKER")
        parameter.integer("bar",0,30,15)
        score = 0
        f = 0
        n = 1
        ball = vec2(17,5)
        vel = vec2(0,1)
        lev = row..rep("#",36).." * AWESOME * "..rep("#",46).." * FXs * "..rep("#",36)..rep(row,4)
    end
    function draw()
        local tb = ball + vel
        local pos,b = math.floor(tb.x + tb.y*35)+1, rep(" ",bar).."====="..rep(" ",30-bar)
        local s = b..lev..b
        if f >= 8 then
            f = 0
            lev = string.gsub(string.gsub(lev,"-"," "),"+","-")
            local hit = sub(s,pos,pos) ~= " " and sub(s,pos,pos) or nil
            if ball.x == 35 or ball.x == 0 then
                vel.x = vel.x * -1
            end
            local win = #string.gsub(s," ","") == 10 and "WOW, IMPRESSIVE !"
            if ball.y == 0 or ball.y == 10 or win then
                PARAM_BREAKER = rep(row.."\n",4).."\t\t"..(win and win or "GAME OVER")
                PARAM_BREAKER = PARAM_BREAKER.."\n\t\t\t\t"..score.." points"..rep("\n",7)
                draw = function() end
                return
            end
            if hit == "=" then
                vel = vec2((ball.x - bar - 2)/2,vel.y * -1)
            elseif hit and not string.match(hit,"[%+%-]") then
                score = score + string.byte(hit)
                lev = sub(lev,1,pos-36).."+"..sub(lev,pos-34)
                vel.y = vel.y * -1
            end
            local fx = hit and sound(SOUND_HIT, string.byte(hit)*50)
            ball = ball + vel
            n = math.ceil(ElapsedTime)%5 == 0 and n + .02 or n
        end
        s = sub(s,1,math.floor(ball.x + ball.y*35)).."O"..sub(s,math.floor(ball.x + ball.y*35)+2)
        PARAM_BREAKER = row.."\n"
        for i=1,#s,35 do
           PARAM_BREAKER  = PARAM_BREAKER..string.sub(s,i,i+34).."\n"
        end
        f = f + n
    end
    
  • BriarfoxBriarfox Mod
    Posts: 1,542

    @toffer I think you have done a first! Thats just awesome.

  • Posts: 2,820

    @-) +1 for @toffer's.

  • I think everyone's entry is better than mine, so good job lads, @toffer that's just awesome :o

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @CodeaNoob that contest idea was great! Congrats.

  • edited December 2013 Posts: 1,976

    Challenge accepted.

    -- 50 Lines
    function setup()
        cost, incomePerHouse, Money, Houses = 50, 10, 0, "|#" .. (" "):rep(32) .. "|"
        updateParams()
        loop()
    end
    function buy()
        if Money >= cost and houseC < 33 then
            cost, Money, Houses = cost + 40, Money - cost, "|" .. Houses:sub(2, houseC + 1) .. "#" .. (" "):rep(32 - houseC) .. "|"
            updateParams()
        end
    end
    function upgrade()
        if Money >= cost then
            Money, incomePerHouse, cost = Money - cost, incomePerHouse + 5, cost + 30
            updateParams()
        end
    end
    function updateParams()
        parameter.clear()
        parameter.action("Buy House ($" .. cost .. ")", buy)
        parameter.action("Upgrade Income ($" .. cost .. ")", upgrade)
    end
    function loop()
        output.clear()
        houseC = 0
        for i in Houses:gmatch("#") do
            houseC = houseC + 1
        end
        for i = 1, houseC do
            Money = Money + incomePerHouse
        end
        print("House Tycoon\n\n$$$$    " .. string.format("%19.0f", Money) .. "    $$$$\n\nHouses:\n" .. Houses .. "\n\nIncome: " .. houseC * incomePerHouse .. "\n\nIncome per house: " .. incomePerHouse)
        tween.delay(1, loop)
    end
    

    I'm late to the party, but there is is. A house tycoon. Uses parameters and the tween library if you count those as cheats. Proper indentation on everything though, not stacking multiple lines into one.

    Only 34 lines, too.

  • edited December 2013 Posts: 577

    Here is another one, its the first project I've made on Codea so it might be a bit sloppy.

    function setup()
            --Set the score to 0
              score = 0     
        --List of posible places for the bug to be
            bugy = {50, 100, 200, 300, 400, 500 ,600, 700, 800}      
      --Coordinates of the bug
        coords = vec2(600, 600)
        time = 0  
      --Width and height if the bug
        h = 200 
        w = 200  
    end
            function draw()
    
     --Add 1 to the time
        time = time + 1
    
        --If the time is equal to 120 then redi the bugmand the time,cand takeaway a bit of the score
        if time == 120 then
    bugmove()
            times()
            score = score - 50
            end
    
     background(124, 177, 69, 255)
    --Locations of the bug
        sprite("Planet Cute:Enemy Bug",coords.x, coords.y, w, h)
        --Show how many points the player has
        fill(184, 72, 47, 255)
        font("Marion-Regular")
        fontSize(70)
    text(score, 600, 700)
    end
    --Test if your finger is on the bug, or "mole", if so, call function bugmove and time
        function touched(touch) 
        if math.abs(touch.x-coords.x)<w/2 and math.abs(touch.y-coords.y)<h/2 then
             bugmove()
        times() 
            score = score + 200    
    end
    
    end
    
    function times()    
        time = 0   
        end
            function bugmove()  
                coords.x = bugy[math.random(1, 9)]
                coords.y = bugy[math.random(1, 9)]
            end
    

    It doesn't cheat with parameters or putting multiple lines on one. It also includes comments.

  • dave1707dave1707 Mod
    edited December 2013 Posts: 7,809

    Here's another one I wrote a long time ago. Got it to 50 lines.

    EDIT: Had to add portrait mode.

    displayMode(FULLSCREEN)
    supportedOrientations(PORTRAIT)
    function setup()
        cx,cy,limit,tab1,tab2=0,0,150,{},{}  
        create()
        circ1=physics.body(CIRCLE,5)
        circ1.x=300
        circ1.y=HEIGHT-50
        circ1.gravityScale=.5
        circ1.restitution=1
        line1=physics.body(EDGE,vec2(0,0),vec2(0,HEIGHT))
        line2=physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT))
        line3=physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
        line4=physics.body(EDGE,vec2(0,HEIGHT),vec2(WIDTH,HEIGHT))     
    end
    function create()
        for x=1,limit do
            tab1[x]=physics.body(CIRCLE,10)  
            tab1[x].x=math.random(20,WIDTH-20)
            tab1[x].y=math.random(HEIGHT)
            tab1[x].type=STATIC
            tab2[x]=0
        end       
    end
    function collide(contact)
        if contact.state == BEGAN then
            cx=contact.bodyA.x
            cy=contact.bodyA.y
            if circ1.y < 20 then
                circ1.y=HEIGHT-50
                circ1.x=math.random(WIDTH)
            end
        end   
    end
    function draw()
        background(0, 0, 0) 
        fill(255,0,0)    
        ellipse(circ1.x,circ1.y,10,10)
        for x=1,limit do
            if cx==tab1[x].x and cy==tab1[x].y then
                tab2[x]=1 
                cx,cy=0,0
            end        
            fill(255)
            if tab2[x] > 0 then
                fill(math.random(255),math.random(255),math.random(255),255)
            end        
            ellipse(tab1[x].x,tab1[x].y,20)     
        end
    end
    
  • IgnatzIgnatz Mod
    Posts: 5,396

    Fly through an asteroid belt

    function setup()
        LoadImages()
        minX,maxX,minY,maxY,shipX,shipY=-WIDTH/2,WIDTH/2,-HEIGHT/2,HEIGHT/2,0,0
        startDist,asteroidRate,timer,alreadyCreated,A=100,20,0,0,{}
        displayMode(FULLSCREEN)
    end
    
    function LoadImages()
        Rocks={} for i=1,9 do 
        Rocks[#Rocks+1]=readImage("Tyrian Remastered:Space Ice "..i) end
        for i=1,7 do Rocks[#Rocks+1]=readImage("Tyrian Remastered:Rock "..i) end
    end
    
    function AddAsteroid()
        local a={}
        a.x,a.y,a.rs=math.random(minX,maxX),math.random(minY,maxY),math.random(-1,1)
        a.s,a.d,a.r,a.img=math.random(1,3),startDist,0,Rocks[math.random(#Rocks)]
        table.insert(A,a)
    end
    
    
    function draw()
        background(0)
        timer=timer+DeltaTime
        local a=timer*asteroidRate
        for i=1,a-alreadyCreated do AddAsteroid() end
        alreadyCreated=math.floor(a)
        local n=0
        for i,a in pairs(A) do
            n,a.d=n+1,a.d-.1
            if a.d==0 then table.remove(A,i) 
            else 
                a.r=a.r+a.rs
                local v=(startDist/a.d)^.5
                local xx,yy=WIDTH/2+a.x*v,HEIGHT/2+a.y*v
                if xx<0 or xx>WIDTH or yy<0 or yy>HEIGHT then table.remove(A,i)
                else
                    local w=a.img.width*a.s/a.d
                    if w>3 then
                        pushMatrix()
                        translate(xx,yy)
                        rotate(a.r)
                        sprite(a.img,0,0,w)
                        popMatrix()
                    else sprite(a.img,xx,yy,w) end
                end
            end
        end
    end
    
  • Posts: 257
    displayMode(FULLSCREEN)
    
    function setup() score1=0 ; score2=0 ; init() end
    
    function init()
        tx={10,10,10,10,10} ; tour=1 ; etape=1 ; c1={1,2,3,4,5} ; c2={1,2,3,4,5} ; arrivee=math.random(400,700) ; tc=""
        for i=1, 50 do  j=math.random(5) ; tmp=c1[j] ; k=math.random(5) ; c1[j]=c1[k] ; c1[k]=tmp
           j=math.random(5) ; tmp=c2[j] ; k=math.random(5) ; c2[j]=c2[k] ; c2[k]=tmp  end
    end
    
    function draw()
        background(234, 164, 29, 255) ; spriteMode(CORNER) ; fontSize(35) ; textMode(CORNER) ; fill(0, 0, 0, 255)
        if etape==1 then text("Strategy's Game for 2 players",10,400)
        elseif etape==2 then text("Player 1 your combi             Score = "..score1,10,400)
        elseif etape==3 then text(table.concat(c1, "," ),10,400)
        elseif etape==4 then text("Player 2 your combi             Score = "..score2,10,400)
        elseif etape==5 then text(table.concat(c2, "," ),10,400)
        elseif etape==6 then 
            fill(214, 73, 42, 255) ; if tour==1 then xc=20 else xc=850 end ; rect(xc-5,100,140,50)
            fill(16, 14, 14, 255) ; text("Player 1",20,100); text("Player 2",850,100)
            text(score1,20,50); text(score2,850,50)
            if tc=="" then else text(table.concat(tc, "," ),300,50) end
            for i=1, 5 do sprite("SpaceCute:Rocketship",tx[i],700-i*100,25*5,18*5) ; text(i,800,700-i*100) end
            stroke(255) ; rect(arrivee,200,1,500)
        end
        if ( CurrentTouch.state == BEGAN and oldState ~= CurrentTouch.state )
        then
            if etape==6 then val=7-math.ceil((CurrentTouch.y-110)/100+0.5)
                if val>=1 and val<=5 then tx[val]=tx[val]+math.random(30)+30 ; text(tx[val],900,700-val*100)          
                    text(val,10,10) ; if tour==1 then tour=2 else tour=1 end 
                    if tx[val]>=arrivee-25*5 then tc={1,2,3,4,5} ; itemCount=5
                      repeat hasChanged = false ; itemCount=itemCount - 1
                        for i = 1, itemCount do
                            if tx[i] < tx[i+1] then
                                tx[i], tx[i+1] = tx[i+1], tx[i] ; tc[i], tc[i+1] = tc[i+1], tc[i] ; hasChanged=true
                             end
                        end
                      until hasChanged == false
                      for i=1, 5 do
                        if c1[i]==tc[i] then score1=score1+1 end ; if c2[i]==tc[i] then score2=score2+1 end
                      end
                      init()
                    end
                end
            else
              if etape==1 then etape=2 elseif etape==2 then etape=3 elseif etape==3 then etape=4
              elseif etape==4 then etape=5 elseif etape==5 then etape=6 end
            end
        end oldState=CurrentTouch.state
    end
    
  • Posts: 257

    it's an original strategic game for two players in 50 lines
    the goal is to find the best combination and have the best score

  • IgnatzIgnatz Mod
    Posts: 5,396

    Another one for kids. Touch the biggest fish on screen at any time, to score points. Touch the wrong fish and lose.

    I don't claim any great programming skills in here, but anyone who is starting out may be interested in how you can make the fish swim up and down using math.sin, and how the fish colours tend to match each other because a single base colour is blended with a random colour.

    function setup()
        supportedOrientations(LANDSCAPE_ANY)
        displayMode(FULLSCREEN)
        start()
    end
    
    function start()
        if score then if score>high then high=score end else high=0 end
        fish,bias,timer,score={},color(255,0,0),0,0,0
        for i=1,20 do MakeFish() end
    end
    
    function MakeFish()
        local w=math.random(50,150)
        local h=w*(.25+.75*math.random())
        local f=image(w,h)
        pushStyle() setContext(f)
        local r,g,b=math.random(0,255),math.random(0,255),math.random(0,255)
        local c=color(r,g,b,255*math.random())
        fill(c:blend(bias))
        strokeWidth(1)
        ellipse(w*.4,h*.5,w*.8,h)
        ellipse(w*0.9,h*.5,w*.2,h*.5)
        ellipse(w*0.1,h*0.6,8)
        setContext() popStyle()
        local ff={}
        ff={f=f,x=WIDTH*(1+math.random()*.5)+w,y=50+math.random(HEIGHT-100),s=0.5+2*math.random(),w=w,h=h}
        table.insert(fish,ff)   
        fill(43, 48, 138, 255) fontSize=24 textMode(CORNER)
    end
    
    function draw()
        background(161, 196, 203, 255)
        timer=timer+DeltaTime
        if timer>10 then bias=color(math.random(0,255),math.random(0,255),math.random(0,255)) timer=0 end
        for i=#fish,1,-1 do
            local h=math.sin(fish[i].y+fish[i].x/90)
            sprite(fish[i].f,fish[i].x,fish[i].y+h*20)
            fish[i].x=fish[i].x-fish[i].s
            if fish[i].x<0 then table.remove(fish,i) MakeFish() end
        end
        text("Score "..score,50,HEIGHT-75) text("High score "..high,50,HEIGHT-100)
    end
    
    function touched(t)
        if t.state==ENDED then
            table.sort(fish,function(a,b) return a.w*a.h>b.w*b.h end)
            for i=1,#fish do if fish[i].x<WIDTH then f=fish[i] j=i break end end
            if t.x>f.x-f.w/2 and t.x<f.x+f.w/2 and t.y>f.y-f.h/2 and t.y<f.y+f.h/2 then 
                score=score+math.floor(f.w*f.h) 
                sound(SOUND_PICKUP, 49249) table.remove(fish,j) MakeFish()
            else sound(SOUND_EXPLODE, 49249) start() end
        end
    end
    
  • SimeonSimeon Admin Mod
    edited December 2013 Posts: 5,054

    @Ignatz Asteroid belt was very cool. Reminded me of the old Windows screensaver. You can depth-sort the asteroids each frame to stop the distant ones overlapping the closer ones:

    table.sort(A, function(a1,a2)
        return (a2.d < a1.d) end)
    for i,a in pairs(A) do ...
      -- ... existing code
  • I'm jelly about how you guys come up with ideas, I never have such great ideas

  • IgnatzIgnatz Mod
    Posts: 5,396

    @stevon8r - I thought exactly the same way. But all you need to do is start by drawing something really simple. Then watch your brain start coming up with ideas.

  • IgnatzIgnatz Mod
    edited December 2013 Posts: 5,396

    @Simeon - I usually depth sort 3D objects, yes. I also find it helps to discard transparent pixels sometimes.

    The interesting thing about this is that I made two versions - one with fake 3D, and the other using 3D. The fake one (this one) looks way more realistic, because for some reason, 3D objects don't seem to draw at all when they are far away, but suddenly jump onto the screen when they are quite big, creating a disjointed and unrealistic effect.

  • Jmv38Jmv38 Mod
    edited December 2013 Posts: 3,295

    [EDIT] modified to add sound and a faster startup


    displayMode(FULLSCREEN) -- 50 lines challenge  - copyright JMV38-2013 local rnd, floor, balls = math.random, math.floor, {} local xt,yt,started, timeLeft,finished, total, rmin, Nballs ; local ball = class() function ball:init()     self.i = #balls + 1 ; balls[self.i] = self ; self:restart() end function ball:touching(otherBall)     local dx,dy = (self.x-otherBall.x), (self.y-otherBall.y)     local d2,r = dx*dx + dy*dy, (self.r + (otherBall.r or 0) )     return (d2 < r*r) end function ball:restart(confirmed)     self.r = 10; self.dt = rnd(100)/10 + 20; self.timeout = ElapsedTime + self.dt     self.x, self.y = rnd(WIDTH-200)+100, rnd(HEIGHT-200)+100     self.dr =  200/60/self.dt; self.c = color(rnd(127)+128, rnd(127)+128, rnd(127)+128) end function ball:draw()     if self.r<rmin then fill(255, 0, 0, 255) else fill(self.c) end     ellipse(self.x,self.y,self.r); self.r = self.r + self.dr     if ElapsedTime>self.timeout then self:restart() end end function ball:score(a,ps) total = total + floor( a*self.r*self.r )      if a<0 then if ps then sound(SOUND_BLIT, 48967) end else sound(SOUND_JUMP, 15197) end end function setup()     xt,yt,started, timeLeft,finished,rmin,Nballs = WIDTH/2,HEIGHT/2,false, 30,false,30,20     ellipseMode(RADIUS) textWrapWidth(WIDTH/1.5)      fill(255) fontSize(30) font("AmericanTypewriter-Bold")      total = "Touch the colored bubbles to score, bigger bubbles make bigger score. "..     " Score decreases when you touch red ones or when 2 bubbles touch each other. You have 30s." end function finish() balls = {}; fontSize(100); yt = HEIGHT/2; finished =true end function start()  started = true ; total = 0 ; xt = WIDTH/2; yt = HEIGHT -100; timeLeft=30     for i=1,Nballs do tween.delay(i/3,ball) end end function touched(touch)     if finished then return elseif started then         for i,b in ipairs(balls) do if b:touching(touch) then local a = 1         if b.r<rmin then a=-1 end b:score(a, (a<0)) b:restart() end end     else start() end end function draw()     background(40, 40, 50)     for i,b in ipairs(balls) do b:draw() end     for i = 1, Nballs-1 do for j = i+1, Nballs do local b1,b2 = balls[i],balls[j] if b1 and b2 and b1:touching(b2) then b1:score(-1,true) b2:score(-1) b1:restart() b2:restart() end     end end     fill(255) text(tostring(total),xt,yt) text(tostring(floor(timeLeft)),xt,100)         if timeLeft < 1 then finish() end     if started and not finished then timeLeft = timeLeft - DeltaTime end end
  • Jmv38Jmv38 Mod
    Posts: 3,295

    I think this format (50 lines) is really an interesting exercise. It is surprising how much can be made within it.

  • SimeonSimeon Admin Mod
    Posts: 5,054

    @Ignatz that sounds like they are being frustum culled — see the perspective() function documentation:

    http://twolivesleft.com/Codea/Reference/Graphics.html#perspective

    When setting up the perspective a default near and far clipping plane are assumed. These are two planes perpendicular to the viewpoint. Any geometry outside of these planes is culled.

    The default far plane is set based on the height of the view frustum (i.e., HEIGHT by default). So if you use a larger distance for your far clipping plane, then your objects should be able to draw further away.

  • IgnatzIgnatz Mod
    Posts: 5,396

    Thanks, @Simeon, I should have thought of that...

  • Air code is so awesome. I am copying and pasting your various projects in there and seeing it run on my iPad. Amazing! My two kids thought the bubble popping app was fun. I liked the asteroid app. Param Breaker was completely unexpected.

  • edited December 2013 Posts: 198

    Assuming my server is operational, to get the images, this won't crash codea...
    It's a little ship that you remote control and fly around in space to your hearts content.

    Any ideas on a more elegant way to share image resources are welcome.

    Enjoy!

    
    -- Space50, Doh! Just realized comments don't count as lines.....
    -- Ah well, you didn't want to know what was going on anyway, right?
    function setup()
        p1Angle = 0;p1ThrustAngle = 0;p1Ship = vec2(400,200);p1Speed = vec2(0,0)
        p1ThrustSpeed = .07;p1TopSpeed = 3;thrustButP1 = vec4(250,0,350,100)
       leftImage = image(100,100); rightImage=image(100,100);thrustImage = image(100,100)
    shipImage = image(100,100);rocketsImage = image(100,100)
        http.request("http://www.mrscience101.com/images/left.png", getLeftImage)
        http.request("http://www.mrscience101.com/images/right.png", getRightImage)
        http.request("http://www.mrscience101.com/images/thrust.png", getThrustImage)
        http.request("http://www.mrscience101.com/images/ship.png", getShipImage)
        http.request("http://www.mrscience101.com/images/rockets.png", getRocketsImage)
        touches = {}; end
    function touched(touch)
        if touch.state == ENDED then touches[touch.id] = nil
        else touches[touch.id] = touch;end;end
    function draw()
        background(0,0,0);stroke(0, 0, 0, 255);fill(0, 0, 0, 255);
        for k,touch in pairs(touches) do
            xTouch = touch.x; yTouch = touch.y
            CheckIfThrustButtonPushed(touch)
    if touch.x < 200 then
        if touch.y < 200 then
            angleX = touch.x - 100;angleY = touch.y - 100
            if angleX <0 then p1Angle = p1Angle + 3;end
            if angleX> 0 then p1Angle = p1Angle - 3;end;end;end;end;
    pushMatrix(); p1Ship.x = p1Ship.x + p1Speed.x; p1Ship.y = p1Ship.y + p1Speed.y
        if p1Ship.x < -16 then p1Ship.x = WIDTH +16;end
        if p1Ship.x > WIDTH + 16 then p1Ship.x = -16;end    
        if p1Ship.y > HEIGHT + 16 then p1Ship.y = 100-16;end
        if p1Ship.y < 100-16 then p1Ship.y = HEIGHT + 16; end
        translate(p1Ship.x,p1Ship.y);rotate(p1Angle)
        if shipThrust == true then sprite(rocketsImage, 0,0,32)
        else  sprite(shipImage,0,0,32); end; popMatrix()
    sprite(leftImage,50,50);sprite(rightImage, 150, 50);sprite(thrustImage, 300, 50)
    shipThrust = false;end
    function CheckIfThrustButtonPushed(touch)
        if touch.x > thrustButP1.x and touch.x < thrustButP1.z then
            if touch.y> thrustButP1.y and touch.y < thrustButP1.w then
                shipThrust = true
                p1ThrustAngle = math.rad(p1Angle+90)
                p1Speed.x = p1Speed.x + p1ThrustSpeed * math.cos(p1ThrustAngle)
                p1Speed.y = p1Speed.y + p1ThrustSpeed * math.sin(p1ThrustAngle)
                if p1Speed.x > p1TopSpeed then p1Speed.x = p1TopSpeed;end
                if p1Speed.x < -p1TopSpeed then p1Speed.x = -p1TopSpeed;end
                if p1Speed.y > p1TopSpeed then  p1Speed.y = p1TopSpeed; end
                if p1Speed.y < -p1TopSpeed then p1Speed.y = -p1TopSpeed;end;end;end;end  
    function getLeftImage( theImage)leftImage= theImage;end
    function getRightImage( theImage)rightImage= theImage;end
    function getThrustImage( theImage)thrustImage= theImage;end
    function getShipImage( theImage)shipImage= theImage;end
    function getRocketsImage( theImage)rocketsImage= theImage;end
    
  • edited December 2013 Posts: 0

    Hehe my nooby fail...

    -- conors text printer
    
    -- Use this function to perform your initial setup
    function setup()
        print("Hello World!")
        parameter.text("Title", "TEXT WRITER")
        parameter.text("TEXT", "HELLO WORLD")
        parameter.number("fontsize", 0, 100, 40 )
        parameter.number("X", 0, WIDTH, WIDTH/2)
        parameter.number("Y", 0, HEIGHT, 450)
        parameter.number("fontsize2", 20, 80, 20)
        parameter.number("AmountofRed", 0, 250, 250)
        parameter.number("AmountofGreen", 0, 250, 250)
        parameter.number("AmountofBlue", 0, 250, 250)
        parameter.number("AmountofOpacity", 0, 250, 250)
    end
    
    -- This function gets called once every frame
    function draw()
        background(0, 0, 0, 255)
        fill(AmountofRed, AmountofGreen, AmountofBlue, AmountofOpacity)
        fontSize(fontsize)
        font("Noteworthy-Light")
        textWrapWidth(WIDTH)
    
        text(TEXT, X, Y)
    
        fill(172, 170, 170, 255)
        fontSize(fontsize2)
        font("AmericanTypewriter-Bold")
        textWrapWidth(WIDTH)
    
        text(Title, WIDTH/2, 700)
    
        parameter.number("fontsize", 20, 80, 40 )
    
        fill(127, 127, 127, 255)
        fontSize(30)
        font("Baskerville-Italic")
        text("Created by Conor Demetriades", WIDTH/4, 50)
    end
    

    Yes I know my surname's awesome.
    No I don't sign autographs
    Only joking I'm not that vain my surname isn't awesome
    Αντίο κορήτσια

  • Posts: 577

    @TheRogueBatcher It's not bad, actually! Keep learning! :)>-

  • Posts: 1,976

    @TheRogueBatcher Looks cool, but I have to say, the parameter.number for the font size should be in setup, and RGBA goes from 0-255, not 0-250.

  • @Prynok
    Thank you and I will
    @SkyTheCoder
    The RGBA error I understand but the location of the parameter is irrelevant. It still does the same thing. Until it actually has a critical fault I don't see the problem. Also what do you mean the parameter should be in setup. It's already there

    -- conors text printer
    
    -- Use this function to perform your initial setup
    function setup()
        print("Hello World!")
        parameter.text("Title", "TEXT WRITER")
        parameter.text("TEXT", "HELLO WORLD")
        parameter.number("fontsize", 0, 100, 40 )
        parameter.number("X", 0, WIDTH, WIDTH/2)
        parameter.number("Y", 0, HEIGHT, 450)
        parameter.number("fontsize2", 20, 80, 20)
        parameter.number("AmountofRed", 0, 250, 250)
        parameter.number("AmountofGreen", 0, 250, 250)
        parameter.number("AmountofBlue", 0, 250, 250)
        parameter.number("AmountofOpacity", 0, 250, 250)
    end
    

    It's on line 8 see?

Sign In or Register to comment.