Help me creating an ipad app, please. Thanks!

Question:
SupportedOrientation(landscape_any) works within codea, but not on the compiled app.
Any hint on what i should do to make it work?
Thanks!

@Crumble yeah ads are working okay for me, but my only app with ads out is a cheap game that matches your description exactly. Getting downloads is not hard, but people tend to delete it once they release it is cheap, and with ads they have to play it for you to profit.

@jrohanian Yeah, I think even if the game is simple and cheap looking, as long as its super addicting, it can catch on and become popular and make money.

The creator of flappy bird, Dong Nguyen specializes in those simple addicting apps, his other apps Shuriken Block, Super Ball Juggling, and Swing Copters are all successful also. Those are the types of games I am focused on making.

@Jmv38 There is a setting in Xcode to choose what orientation the app uses.

For saving local data, I use readLocalData and saveLocalData. This is what I do that works on devices:

In the setup function is (this just keeps you from getting a nil value error):


if readLocalData("HS")== nil then
        saveLocalData("HS", 0)
end

Then for saving a new high score I do this:


if score > readLocalData("HS") then
            saveLocalData("HS", score)
end

Then to display the high score:


text("HighScore: "..readLocalData("HS"),WIDTH/2,HEIGHT/2)

All of the above works fine in testflight on devices.

Here is an example of a full game that uses it (all sound, highscores, etc. works on devices)


displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT_ANY)
function setup()
    ast={}
    ship=readImage("Space Art:Red Ship")
    asteroid=readImage("Space Art:Asteroid Large")
    astFreq=1.5
    astSpeed=-9
    score=0 -- starting score
    timer=0
    rectMode(CENTER)
    if readLocalData("HS")== nil then
        saveLocalData("HS", 0)
    end
    music("A Hero's Quest:Battle",true,.5)
    gameState=0
    font("Futura-CondensedExtraBold")
    fontSize(64)
    fill(0, 255, 0, 255)
    shipX=WIDTH/2
    shipY=HEIGHT/4
end
function spawn()
    table.insert(ast,vec2(math.random(96,WIDTH-96),1152))
end
function draw()
    if gameState==0 then
        background(0, 0, 0, 255)
        text("PLAY",WIDTH/2,HEIGHT/2)
        if CurrentTouch.state==BEGAN then
            if CurrentTouch.x>WIDTH/2-256 and CurrentTouch.x<WIDTH/2+256
            and CurrentTouch.y>HEIGHT/2-128 and CurrentTouch.y<HEIGHT/2+128 then
                gameState=1
            end
        end
    end
    if gameState==1 then
        background(0, 0, 0, 255)
        pushStyle()
        text("Score: "..score, WIDTH/2, HEIGHT/1.2)
        popStyle()
    for a,b in pairs(ast) do
        sprite(asteroid,b.x,b.y,192,256)
        b.y=b.y+astSpeed
    end
    timer=timer+DeltaTime
    if timer>astFreq then
        spawn()
        spawn()
        spawn()
        timer=0 
        end
    for a,b in pairs(ast) do
        if b.y<-128 then
            table.remove(ast,a)
            score=score+10
        end
    end
    if CurrentTouch.x <= WIDTH / 2 and CurrentTouch.state ~= ENDED and CurrentTouch.state ~= CANCELLED then
            shipX=shipX-12
        end
    if CurrentTouch.x>WIDTH/2 and CurrentTouch.state ~= ENDED and CurrentTouch.state ~= CANCELLED then
            shipX=shipX+12
        end
    sprite(ship,shipX,shipY,64,96)
    for a,b in pairs(ast) do
            if b.y-96<=shipY+48 and b.y+160>=shipY-48 and
            b.x-96<=shipX+32 and b.x+96>=shipX-32 then
                gameState=2
            end
        end
    if shipX-32<0 or shipX+32>WIDTH then
            gameState=2
        end
    end
    if gameState==2 then
        background(0, 0, 0, 255)
        text("RETRY",WIDTH/2,HEIGHT/4)
        if score > readLocalData("HS") then
            saveLocalData("HS", score)
            end
        text("Score: "..score, WIDTH/2,HEIGHT/1.2)
        text("HighScore: "..readLocalData("HS"),WIDTH/2,HEIGHT/2)
        if CurrentTouch.state==BEGAN then
            if CurrentTouch.x>WIDTH/2-128 and CurrentTouch.x<WIDTH/2+128
            and CurrentTouch.y>HEIGHT/4-64 and CurrentTouch.y<HEIGHT/4+64 then
                score=0
                gameState=0
                shipX=WIDTH/2
                for i,t in pairs(ast) do ast[i]= nil
                end
            end
        end
    end
end

@Crumble I think that if you just upload an app to the app store, you have a better chance of being ran over by a hot pink Lamborghini thats being driven by a polar bear tomorrow than that app going viral. The reason that Flappy Bird went viral was because the biggest youtuber with 30,000,000 subscribers made a video about him ragging at the game. He was a tread setter so everyone else started playing the game and sharing it with their friends.

So if you want your app to go viral then I suggest writing a whole lot of emails to popular media creators asking then to check out your game. Then if they like it then they’ll maybe post something about it on their social media.

@Crumble thanks a lot for your replies. That helps me a lot!

@Goatboy76, getting reviews is probably close to as hard as your app taking off on its own. You really have to know someone or be a large company, or the reviewers couldn’t care less about you.

I think a solid way to do it might be to establish a strong social media presence, gather a following, and then you have a similar power to those reviewers and you can simply post yourself: my game is out, and those followers are more likely to get it

@Goatboy76 True. However, there are other simple games that have gotten popular. The endless runner games, frogger clones, etc. are simple games, and in the top charts.

I just think its too big of a risk to spend hundreds of hours on a single game, when the odds of it flopping are so high.

Also, I am still learning to program, so simple games is all I can do at the moment. Every new game I make is more complex than the last. I figure it’s better to make games that are within my skill set and release them, than to just make a bunch of random unfinished projects.

I do have a few ideas of games that I think would be hits, but they are way beyond my programming skills… one day I will make them, but I have a lot to learn before then.

@Crumble Just a note on your highscore example - I would advise against using local data in your Codea projects, because it doesn’t get deleted along with your project and can be stuck there taking up space. But even if you do use any kind of data, I would also advise against using read(Local/Global/Project)Data in draw. In your example, you were trying to get the highscore 60 times per second, and because file IO isn’t that fast, it would actually lag.

@SkyTheCoder

I don’t know any other way to do it other than saveLocalData and readLocalData.

Good point on the drawing 60 times per second. Should I put the high score update after the gameState change here instead (below)?


for a,b in pairs(ast) do
            if b.y-96<=shipY+48 and b.y+160>=shipY-48 and
            b.x-96<=shipX+32 and b.x+96>=shipX-32 then
                gameState=2
                if score > readLocalData("HS") then
                    saveLocalData("HS", score)
                end
            end
        end

    if shipX-32<0 or shipX+32>WIDTH then
            gameState=2
             if score > readLocalData("HS") then
            saveLocalData("HS", score)
            end
        end
    end

@Crumble Try having a highScore variable that you only update on certain events, such as winning the game or in setup.

And you can save it other ways, you could use saveGlobalData or saveProjectData, now even saveText. They work pretty much the same way as saveLocalData, they just store them in different places. (saveGlobalData is data that can be accessed by any project, not just the one that saved it, so if you use it make sure the data key is unique, because one project could overwrite another project’s data)

@SkyTheCoder, i think readData can go in draw, it is fast enough. that said, it probably isnt the best practice

@SkyTheCoder But will a highScore variable be saved even when the game is turned off?

@Crumble No, I meant just use a highScore variable for easy access to your highscore in your code. You’ll still need to save it.

Do you guys know of a way to publish an app that has your name on the account when your underage without going through the hassle of making a company?

Hello All!
Now i am ready, my little timer works. However, i can’t find in Xcode how to force the orientation to landscape_any.
@Crumble you said it is a setting into Xcode. Could you guide me to the solution? Thanks.

good news: i’ll looked a little bit on the web, the settings seem to be in a .plist file. So i checked into the project, found a info.plist file, opened it, and deselected a couple of portrait settings there. Then compiled again and… tada! Works in landscape only.

here is a video of the version of the timer app i want to submit to app store. There are sounds too, but they are not recorded. Any comment welcome!
http://www.youtube.com/watch?v=9tikqAzv080

QUESTION: do i have to create a web-site to submit to the app store?
Thanks.

@Jmv38

Yes you need some form of website for people to contact you. I believe a facebook page or something for your games will work. I use a Gamesalad profile.

@Crumble thanks.