Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Psych project

edited October 2016 in Examples Posts: 9

The best app to be made on Codea... BEHOLD!!!

-- GusNameGenerator

-- Use this function to perform your initial setup
function setup()
    displayMode(FULLSCREEN)
     names={"Die Harder", "Bighead Burton", "Homeskillet", "Big Baby Burton", "Burt the Billowy Bear", "Blackstar", "Chocolate Columbo", "Magic Head", "Slicks", "Peter Panic", "Gus T.T. Showbiz", "Ovaltine Jenkins", "Schoonie “U-Turn” Singleton", "Vernest Lambert Watkins", "Nick Nack", "Bruton Gaster", "Lavender Gooms", "Lemongrass Gogulope", "Squirts MacIntosh", "Dr. McTook", "Galileo Humpkins", "Gus “Silly-Pants” Jackson", "Fearless Guster", "Shmuel Cohen", "Methuselah Honeysuckle", "Paddy Simcox", "Chesterfield McMilla", "Felicia Fancybottom", "Black and Tan", "Ernesto Agapito Garces con y a de Abelar", "Longbranch Pennywhistle", "Watson Williams", "Scrooge Jones", "Hummingbird Saltalamacchia", "Wally Ali", "Dequan “Smallpox” Randolph", "Trapezius Milkington", "Sterling Cooper", "Burton “Oil Can” Guster", "Hollabackatcha", "Jazz Hands", "Gus Brown", "John Slade", "Detective Miles", "Ron Davis", "Black", "Cheswick", "Shawn", "Magic Eight Ball Head", "Ghee Buttersnaps aka “The Heater”", "The Vault of Secrets", "Jonathan Jacob Jingley-Schmidt", "Santonio Holmes", "Deon Richmond", "Chaz Bono", "MC ClapYoHandz", "G-Force", "Imhotep", "Control Alt Delete", "Donut Holestein", "Yasmine Bleeth", "Lodge Blackman", "Mission Face", "Radio Star", "Trending Ontwitter","Gus the fairy", "Bologna", "Denzel Diggs Underwood Moris Chestnut Washington", "Matt", "Slicks", "Bud", "Black Magic", "Guts", "Gurton Buster", "Mrs. Whittlebury", "Jet Blackness", "Burton Guster Black Spencer", "Bill Ofrights", "Blu Ivy Carter", "Brunton Gastor", "Burton Guster", "Burton Trout", "Darnel Guster", "Hammerin' Gus", "Jonas Gustaphson", "Magic Wish Machine", "Robert Jones", "Sh'Dynasty", "The Wiz", "Winston Zedmore", "V.J.Armitrage", "“Bad News” Marvin Barnes", "Black Cameron", "Black Magic", "Brown Sugar", "Burtine Guston", "Burton Gout-ster", "Count Blackula", "Doma Oragato", "Felicio Del Toro", "Gern Blantston", "Hurricane Carter", "Immaculate Conception", "Django Unchained", "Jet Blackness", "Lerenz Take", "Mr. Tips", "Otis", "Recap Mcgee"}
    buttonx=WIDTH/6
    buttony=HEIGHT/7
    button2x=WIDTH/1.3
    button2y=HEIGHT/7
    screen = 0
    talking = true
    --mySound = 0
    taps = 0
end

-- This function gets called once every frame
function draw()

    -- This sets a dark background 
    background(255, 255, 255, 255)
    if screen == 0 then
        sprite("Documents:sadGus",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
        sprite("Cargo Bot:Dialogue Box",buttonx,buttony,300,150)

        font("Futura-CondensedMedium")
        fill(255, 255, 255, 255)
        fontSize(40)
        text("Get A Gus Nickname",buttonx,buttony)
        fontSize(75)
        text("Welcome to the Gus nickname generator",WIDTH/2,HEIGHT-50)
    end
    if screen == 1 then
        sprite("Dropbox:Gus",WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
        fill(255, 255, 255, 255)
        fontSize(80)
        font("Futura-CondensedMedium")
        textWrapWidth(WIDTH)
        sprite("Cargo Bot:Dialogue Box",button2x,button2y,300,150)
        fontSize(50)
        text("Get Another",button2x, button2y)
        text(chosenName,WIDTH/2,HEIGHT/3)
    end

    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing 

end

function touched(touch)
    if screen == 0 and touch.state == BEGAN and touch.x > buttonx-150 and touch.x < buttonx+150 and touch.y > buttony-75 and touch.y < buttony+75 then
        taps = taps + 1
        screen = 1
        chosenName=names[math.random(1,#names)]
        --nameSounds()
    elseif screen == 1 then
        screen = 1
    end
    if screen == 1 and touch.state == BEGAN and touch.x > button2x-150 and touch.x < button2x+150 and touch.y > button2y-75 and touch.y < button2y+75 then
        mySound:stop()
        taps = taps + 1
        chosenName=names[math.random(1,#names)]
        nameSounds()
    end
end

I also have sound files that go with each name, I don't know how to put sound files into a discussion, if there's a way please tell me and I'll post them.

Comments

  • edited October 2016 Posts: 815

    Here's mine version. In genUser() you see that adjectives and verbs should be stored Splitted because then you have more chances like here you have #noun * #adj different combinations

    function setup()
        displayMode(FULLSCREEN)
        tText = "Touch to generate a nickname"
        uText = ""
    end
    
    function draw()
        background(0, 0, 0, 255)
        fill(127, 127, 127, 255)
        strokeWidth(0)
        rect(0, 0, WIDTH, 100)
        fill(255, 255, 255, 255)
        fontSize(50)
        font("ArialMT")
        text(tText, WIDTH/2, 50)
        text(uText, WIDTH/2, HEIGHT/2)
    end
    
    function touched(t)
        if t.y < 100 and t.state == ENDED then
            local user = genUserName()
            local txt = "Generate another one."
            tText = txt
            uText = user
        end
    end
    
    function genUserName()
        local word = ""
    
        local adj = {"Super", "Great", "Lightning", "English", "German", "American", "Russian", "Asian", "Indish",
        "Green", "Red", "Blue", "Yellow", "Golden", "Silvered", "Bronzed", "Purple", "Multicolored", "Invisible",
        "Required", "Safe", "Ancient"}
    
        word = word .. adj[math.random(1, #adj)] .. " "
    
        local noun = {"Queen", "King", "Player", "Soldier", "Armee", "Earing", "Ring", "Sun", "Moon", "Ultra-Violett",
        "Infra-Rot", "Gangster", "Kansler", "President", "Person", "Universe", "Charachter", "Mister", "Missis",
        "Diamond", "Soul", "Ghost", "Tree", "Project", "Triangle", "Greek", "Legend", "Story", "Picture", "Filter",
        "Website", "Man", "Woman", "Lady", "Girl", "Stone"}
    
        word = word .. noun[math.random(1, #noun)]
    
        return word
    end
    
  • edited October 2016 Posts: 9

    My app was specifically made of the TV show Psych, that's why there were only specific names put in a table.

  • Posts: 815

    Up to sentences

    I received Asian Kansler making photos in the prison :smiley:

    function setup()
        displayMode(FULLSCREEN)
        tText = "Touch to generate a nickname"
        uText = ""
    end
    
    function draw()
        background(0, 0, 0, 255)
        fill(127, 127, 127, 255)
        strokeWidth(0)
        rect(0, 0, WIDTH, 100)
        fill(255, 255, 255, 255)
        fontSize(50)
        font("ArialMT")
        text(tText, WIDTH/2, 50)
        text(uText, WIDTH/2, HEIGHT/2)
    end
    
    function touched(t)
        if t.y < 100 and t.state == ENDED then
            local user = genUserName()
            local txt = "Generate another one."
            tText = txt
            uText = user
        end
    end
    
    function genUserName()
        local word = ""
    
        local adj = {"Super", "Great", "Lightning", "English", "German", "American", "Russian", "Asian", "Indish",
        "Green", "Red", "Blue", "Yellow", "Golden", "Silvered", "Bronzed", "Purple", "Multicolored", "Invisible",
        "Required", "Safe", "Ancient"}
    
        word = word .. adj[math.random(1, #adj)] .. " "
    
        local noun = {"Queen", "King", "Player", "Soldier", "Armee", "Earing", "Ring", "Sun", "Moon", "Ultra-Violett",
        "Infra-Red", "Gangster", "Kansler", "President", "Person", "Universe", "Charachter", "Mister", "Missis",
        "Diamond", "Soul", "Ghost", "Tree", "Project", "Triangle", "Greek", "Legend", "Story", "Picture", "Filter",
        "Website", "Man", "Woman", "Lady", "Girl", "Stone"}
    
        word = word .. noun[math.random(1, #noun)] .. " "
    
        local verb = {"dancing", "playing", "running", "sleeping", "eating", "dying", "making photos"}
    
        word = word .. verb[math.random(1, #verb)] .. " "
    
        local attr = {
        {"on", {"street", "car", "scene", "earth", "tower", "moon", "stars"}},
        {"at", {"station", "park", "river", "tower", "place", "portal", "80th's", "70th's", "80th's", "90th's"}},
        {"in", {"prison", "direction", "box", "middle", "corner"}}
        }
    
        print(#attr)
    
        local n = math.random(1, #attr)
        word = word .. attr[n][1] .. " the " .. attr[n][2][math.random(1, #attr[n][2])]
    
        return word
    end
    
    
    
  • edited October 2016 Posts: 9

    @TokOut this app is awesome! It made me laugh and I'm sure I'll be messing with it for quite a while. Also I got invisible sun running in the corner.

  • Posts: 815

    I have made some changes. Here are the funny ones I received:

    http://m.imgur.com/JtWrKna,6ymN9s3,Z36kXmj

  • Posts: 815
    function setup()
        displayMode(FULLSCREEN)
        tText = "Touch to generate a nickname"
        uText = ""
    end
    
    function draw()
        background(0, 0, 0, 255)
        fill(127, 127, 127, 255)
        strokeWidth(0)
        rect(0, 0, WIDTH, 100)
        fill(255, 255, 255, 255)
        fontSize(50)
        font("ArialMT")
        textWrapWidth(WIDTH)
        text(tText, WIDTH/2, 50)
        text(uText, WIDTH/2, HEIGHT/2)
    end
    
    function touched(t)
        if t.y < 100 and t.state == ENDED then
            local user = genUserName()
            local txt = "Generate another one."
            tText = txt
            uText = user
        end
    end
    
    function genUserName()
        local word = ""
    
        local adj = {"Super", "Great", "Lightning", "English", "German", "American", "Russian", "Asian", "Indish",
        "Green", "Red", "Blue", "Yellow", "Golden", "Silvered", "Bronzed", "Purple", "Multicolored", "Invisible",
        "Required", "Safe", "Ancient"}
    
        word = word .. adj[math.random(1, #adj)] .. " "
    
        local noun = {"Queen", "King", "Player", "Soldier", "Armee", "Earing", "Ring", "Sun", "Moon", "Ultra-Violett",
        "Infra-Red", "Gangster", "Kansler", "President", "Person", "Universe", "Charachter", "Mister", "Missis",
        "Diamond", "Soul", "Ghost", "Tree", "Project", "Triangle", "Greek", "Legend", "Story", "Picture", "Filter",
        "Website", "Man", "Woman", "Lady", "Girl", "Stone"}
    
        word = word .. noun[math.random(1, #noun)] .. " "
    
        local verb = {"dancing",
        "playing " .. randomTable("computer", "piano", "football", "basketball", "handball", "with him-self"),
        "running " .. randomTable(1, 2, 5, 10, 20) .. " kilometres",
        "sleeping",
        "eating " .. randomTable("potatoes", "people", "chickens", "fish", "sharp-meat"),
        "dying " .. randomTable("slowly", "fast", "hard"),
        "making " .. randomTable("selfies", "photos")}
    
        word = word .. verb[math.random(1, #verb)] .. " "
    
        local attr = {
        {"on the", {"street", "car", "scene", "earth", "tower", "moon", "stars"}},
        {"at the", {"station", "park", "river", "tower", "place", "portal", "80th's", "70th's", "80th's", "90th's"}},
        {"in the", {"prison", "direction", "box", "middle", "corner"}},
        {"for", {"ages", math.random(2, 20) .. " years", "centuries", "million years"}}
        }
    
        print(#attr)
    
        local n = math.random(1, #attr)
        word = word .. attr[n][1] .. " " .. attr[n][2][math.random(1, #attr[n][2])]
    
        return word
    end
    
    function randomTable(...)
        arg = {...}
        if #arg >= 2 then
            return arg[math.random(1, #arg)]
        elseif #arg == 1 then
            return arg[1]
        else -- 0
            return ""
        end
    end
    
  • Posts: 815

    Here's my last edit:

    function setup()
        displayMode(FULLSCREEN)
        tText = "Touch to generate a funny sentence"
        uText = ""
        fps = 0
        fps_timer = 0
    end
    
    function draw()
        -- MAIN
        background(0, 0, 0, 255)
        fill(127, 127, 127, 255)
        strokeWidth(0)
        rect(0, 0, WIDTH, 100)
        fill(255, 255, 255, 255)
        fontSize(50)
        font("ArialMT")
        textWrapWidth(WIDTH)
        text(tText, WIDTH/2, 50)
        text(uText, WIDTH/2, HEIGHT/2)
    
        -- COPY
    
        fill(127, 127, 127, 255)
        rect(WIDTH-200, HEIGHT-100, 200, 100)
        fill(255, 255, 255, 255)
        text("COPY", WIDTH-100, HEIGHT-50)
    
        -- FPS
    
        local a = string.find(fps, ".")
        local f = "FPS: " .. string.sub(fps, 1, a + 1)
        local x, _ = textSize(f)
        text(f, 50 + x/2, HEIGHT-50)
    
        fps_timer = fps_timer + 1
        if fps_timer > 20 then
            fps_timer = 0
            fps = 1/DeltaTime
        end
    end
    
    function touched(t)
        if t.y < 100 and t.state == ENDED then
            local user = genUserName()
            local txt = "Generate another one."
            tText = txt
            uText = user
        end
    end
    
    function genUserName()
        local word = ""
    
        local adj = {"Super", "Great", "Lightning", "English", "German", "American", "Russian", "Asian", "Indish",
        "Green", "Red", "Blue", "Yellow", "Golden", "Silvered", "Bronzed", "Purple", "Multicolored", "Invisible",
        "Required", "Safe", "Ancient"}
    
        word = word .. adj[math.random(1, #adj)] .. " "
    
        local noun = {
        randomTable("Queen", "King", "Player", "Soldier", "Earing", "Ring", "Sun", "Moon", "Ultra-Violett",
        "Infra-Red", "Gangster", "Kansler", "President", "Person", "Universe", "Charachter", "Mister", "Missis",
        "Diamond", "Soul", "Ghost", "Tree", "project", "Triangle", "Greek", "Legend", "Story", "picture", "filter",
        "Website", "man", "woman", "lady", "girl", "stone", "armee", "coommunity", "god", "")
            .. " " .. randomTable("is", "was")
        }
    
        word = word .. noun[math.random(1, #noun)] .. " "
    
        local verb = {"dancing",
        "playing " .. randomTable("computer", "piano", "football", "basketball", "handball", "with him-self"),
        "running " .. randomTable(1, 2, 5, 10, 20) .. " kilometres",
        "sleeping",
        "eating " .. randomTable("potatoes", "people", "chickens", "fish", "sharp-meat"),
        "dying " .. randomTable("slowly", "fast", "hard"),
        "making " .. randomTable("selfies", "photos")}
    
        word = word .. verb[math.random(1, #verb)] .. " "
    
        local attr = {
        {"on the", {"street", "car", "scene", "earth", "tower", "moon", "stars"}},
        {"at the", {"station", "park", "river", "tower", "place", "portal", "80th's", "70th's", "80th's", "90th's"}},
        {"in the", {"prison", "direction", "box", "middle", "corner"}},
        {"for", {"ages", math.random(2, 20) .. " years", "centuries", "million years"}}
        }
    
        local n = math.random(1, #attr)
        word = word .. attr[n][1] .. " " .. attr[n][2][math.random(1, #attr[n][2])]
    
        return word
    end
    
    function randomTable(...)
        arg = {...}
        if #arg >= 2 then
            return arg[math.random(1, #arg)]
        elseif #arg == 1 then
            return arg[1]
        else -- 0
            return ""
        end
    end
    
Sign In or Register to comment.