Skip to content

If you are new here

May 19, 2013

I suggest you start at post number 1, because the early posts try to explain important Codea concepts, and because they are way simpler than the latest posts. (This blog has followed my learning process with Codea, so it starts off very basic, and grows with my knowledge).

Have fun!

From → Programming

24 Comments
  1. Ken Duerden permalink

    Lets call it a well deserved rest, after all nobody is paying you to do this and like many others on the web your doing this for the benefit of others and the satisfaction of helping others. Enjoy the break.

  2. Jaywant Patil permalink

    Thanks for a great job well done. One question what does x= x+1 really do in the modified Hello World do? Thanks again

    • Imagine the word “let” in front, ie
      Let x=x+1
      It tells Codea that x is equal to its previous value plus one

      But if you don’t know that, then you’re coming to my tutorials too early. You should read up on Lua first, and get used to writing simple commands in it.

  3. D&D permalink

    Thank you ver much for the great job! Well done! I wish I had more time to spend with CODEA …

  4. Nick Iversen permalink

    Sprites, meshes, shaders, OpenGL – it’s all a bit daunting for a beginner. To learn all this stuff I have decided on a project:

    I’d like to draw a playing card face down then use a swipe to turn it over so that at some point the card is bent and both sides can be seen at once.

    Can you outline the steps (so that I don’t go down the wrong path by e.g. using a sprite when I should use a mesh) that I should do. I’ll fill in the gaps, create the code, and put them together as a tutorial.

    • It sure is daunting! My recommendation is to learn it in chunks, starting with some Lua, and then get into simple Codea stuff. Don’t worry about shaders and OpenGL at all, until you feel ready for them.

      Your project of turning a card over essentially requires you to draw both sides of the card, back to back, and – if the hidden side of the card is not symmetrical, It needs to be drawn back to front (mirror image). It also needs to be in 3D, so you can rotate the card. This requires a basic understanding of how to draw in 3D (cameras etc) and you could use addRect to add the front and back images. You are likely to have a problem which is that if you place the two images too close together, OpenGL will get confused and you will see one image sporadically poking through the other (you can see this in my 3D table top scene), but if you place them too far apart, you’ll have a noticeable gap.

      If you’re a beginner, I would definitely not try this unless you have other programming experience. I had experience, and I still learned Codea a bit at a time.

    • If you are still keen, I’ll put together some steps for you.

      But although learning Codea takes a bit of time, it is worth it. I have no prior graphic programming experience because it was too hard, and for the first time I’ve been able to do it, thanks to Codea.

  5. Nick Iversen permalink

    I already have created a project using meshes where I display 54 2D cards floating around the screen. So I know enough Lua and Codea to do that. And I know how the juice sprite animation works. Next step is to do a juice on 3D cards. I’m prepared to put in as much work as required because it is fun and is also a way of contributing back to the Codea community from which I have learned so much from the code they have made available.

    I want to minimise the trial and error so it would be more productive to know where to start and maybe a few steps along the way so that I don’t go off track.

    • What I do, as you may have seen, is to break the project into steps, and figure out how to do each one, then put them together one at a time. It’s difficult to advise you without seeing exactly what you want to do.

      If you want other people to be able to use your code in their projects, then try to make it easy to understand and easy to use.

  6. Nick Iversen permalink

    OK here’s an example – I want to do this but also see both sides of a card at some point in time

    • Hi Nick. Let’s start with showing one side. The video shows a card walking. Any kind of animation of this kind usually requires a set of images that you show in succession to create the illusion of walking.

      An alternative is to use meshes, and somehow get them to wave in the right way. If you have a look at the Cloth Simulation demo project included with Codea, it has the kind of movement you are looking for. I appreciate you have to wave the iPad around to get movement, but it may be possible to artificially create the same effect if you dig into the way it’s done.

      A mesh can be turned around so you see the other side, but it will just be the mirror image of the front side. If you want to see the back of a card, then you have to draw a second mesh behind the first, with the image for the back. You’ll have to draw a mirror image of it to get it to look right (unless it’s symmetrical on the x axis, then it doesn’t matter). If you draw the back mesh too close too the front mesh (eg within about 0.3 pixels), OpenGL may get confused and show bits of both images, but if you draw them too far apart, you’ll be able to see they are separate, so it takes a bit of messing around.

      If you are going to wave the image to make it walk, then the back mesh needs to do the same, but as a mirror image.

      Are you sure you still want to do this? 😉

  7. Nick Iversen permalink

    I’m definitely doing this project as I have already coded up cards using meshes. The cards will definitely flip. The only optional part is to let them buckle as they flip. But I’d like to get that in as it gives cards a bit of personality.

    Since you have been talking about OpenGL and meshes and I have started with meshes I am reassured that I’m on the right track so far. 🙂

  8. Donald permalink

    I am very frustrated and ready to quit, I say this respectfully. After reading the tutorials and your tutorials on my Codea software nothing much has changed from my practice. It’s been 4 days and the only thing I know how to do is make colorful backgrounds and circles and type in “Hello World!” Got so annoyed by that phrase I changed it to display different messages in place of that one. I can’t even program a rectangle to appear on screen. I haven’t looked at every tutorial because I got lost real quick. By now you can tell I have no programming experience at all. None of the tutorials I have read and practiced start with just the basics and gradually advance. It’s haphazard and chaotic. Instead you get basics with a whole lot of advanced learning thrown randomly in the middle of it. Is there any other tutorials elsewhere where I can get some help. Apple has a bad habit of not including an official instruction manual for their products but instead expect you to fend for yourself learning from random tutorials from anywhere besides the company. Sorry for the rant but please I need some help. Thank You and with respect.

    • Donald, I understand your understandable frustration, but I think your expectations may have clashed with reality, and there are some things you need to understand (which is not meant to be a criticism).

      1. Programming is not easy. Codea is the easiest and most fun way to learn graphic programming, but it’s still not easy. You need to accept that, and be prepared to struggle. I have learned several different languages, and the first few weeks are always a struggle – no different from learning a foreign language like German or Japanese, though. …And if you think Codea is hard, try Objective C, the language Apple provides for programming mobile apps!

      2. Following on from this, don’t assume you won’t succeed, because you are struggling. Everybody feels stupid at first, until things begin to feel familiar and you start “getting” how it all works.

      3. If you want really organised tutorials, then learn a major programming language and be prepared to pay for lessons or for a book. Codea is a great app, but it has a relatively small user base, is not supported by Apple (Codea is not an Apple product, after all), and all the tutorials come from keen users like myself who donate our time for free, to make things better for others. If that means the tutorials are not as professional or thorough as they should be, or that there isn’t a whole suite of Youtube tutorials, well, that comes with being small. And sure, the app developers haven’t produced great tutorials, but they have done such a good job with the app, we forgive them that.

      4. The flipside of being a small community is that we have a great forum and a very supportive bunch of users, who go to great lengths to help anyone with a problem.

      5. Is it worth the effort? If you read the comments of experienced users, definitely, some of whom say they’ve used it every day since buying it. I am one of those. I love how it lets me create iPad apps and explore 3D graphics, which I have never been able to do before.

      I encourage you to keep trying, and rather than trying to learn Lua (the language behind Codea) and Codea at the same time, you learn some Lua first. Have you tried my Lua ebook, referenced in the post above? It is intended to be for people with no experience. It means you don’t get to do graphics for a while, but you need to learn some of the language and concepts before you start drawing anything.

      • Donald Strother permalink

        Your right, I’ve got to learn to get out of my consumer microwave mentality of wanting things done instanty. I apologize for getting emotional, I have a tendency to freak out when encountering the unexpected. Right now I am trying to condition myself to not let things bother me when things don’t go according to plan on a project. I should remember like you have said in one of your tutorials, you been their too. Thanks for the reply. When I get worked up I should remember, have fun, which is the purpose of this program.

      • That’s right. It’s like learning carpentry, tennis or Italian. There’s an initial period where you feel like a total idiot.

        But we all think its worth it, and we come from all over the world and range from age 11 to 60 or more.

      • Donald Strother permalink

        Nothing good happens without work and dedication. It’s also nice to know we have a Codea community that can give us a hand when we get stuck.

  9. Donald Strother permalink

    I did try reading the the Lua ebook to try to get a better grasp of how and why everything works in Codea because I felt that just memorizing certain codes in tutorials would not be enough for first timers like myself so I concluded I needed to know the semantics and the why, laws, and rules behind the exercises I practiced repeditively because as I progressed past the first lesson I kept encountering things entirely unfamiliar to the point it seemed the tutorials were making up the rules as it went along, or assumed I knew more than I actually did and would not have as much trouble, I found myself saying huh? what? a lot. I thought reading the Lua manual would shed light on my question. At first I do admit it did for the first 2 or 3 pages, but then I got lost. But if you get lost stop and ask for directions. And that’s why there is a forum. I will start checking out the forums now that I have become a member. I do not see your advice as criticism, but rather as pointing me in the right direction, which is good. I will try to set more realistic goals for myself from now on while waiting for that day when I have learned enough to do something really cool with Codea.

  10. Donald Strother permalink

    I will also try to keep my comments on your page less wordy from here on out.

  11. I just found this blog and i am giving a warning to the owner… I WILL READ IT ALL. THANKS!!! :p

  12. Are the ebooks mentioned in post 1 still available? The shares dropbox links don’t work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: