Friday 31 August 2012

Programming for beginners – part 4

programming for beginners - RAM I hope everybody understands my previous posts. If not please let me know what is not clear and I’ll try to clarify.

What you see here is the actual MEMORY. I don’t want to get to technical so I’m just going to say that inside of these little boards resides the information that we are going to work with.

How? we don’t care for now.

Remember last time we were talking about boxes, and variables. So to recap from last week, a ScreenshotSmallvariable is representation of a container, such as a box. It holds information: numbers, names, dates, images, sounds, music, etc. In our case with MINIFONO (or Candy Toy phone) we have a screen where we have all the buttons that represents the numeric pad of a phone. Each of these button’s has different attributes: size, image, location and is tied to a specific functionality, more on that later. For example the number one is a button that has an image attached to it. It also has a position on the screen. A size. So we can say that there are several variables assigned to button number one.

And because there are several of these variables or boxes it’s a good idea to go to the hardware store and buy a bigger box to hold all these variables together. But first let’s define what we know now. And here comes the part were we actually code. In LUA we do it this way.

local buttonOne   <—here we name it, we create the box but we don’t assign any value yet

And since we came back from the hardware store with a bigger box we are going to use it for buttonOne. In it we are going to store the image that was created previously. Like this:

buttonOne = display.newImage(“buttonOne.png”)  <—that’s the way you do it in Corona SDK, more later.

buttonOne now has become the bigger box that will from now on contain the other attributes we discussed just now. In the next episode we will assign the size, the location on screen, etc.

Friday 24 August 2012

More programming for beginners – part 3

Guess who forgot to post!

Anyhow let’s get to this week’s lesson: Variables!

I know it doesn’t sound fun but this is a very important concept. So what is a variable? Is a tag, or a box that contains information in it.

Let’s say we need to add 2 numbers and show the result. So we ask the user for the first number and STORE it in the first box, we call this first box, let me see what could be an original name? How about BOX1, now my brains are melting.

Let’s call the second box BOX2. In box2 we store the second number but wait we still need a third box, in this one we need to store the result of the adding operation. We call this box resultbox. Do you follow me? And then we tell the computer to add, we do it this way:

RESULTBOX = BOX1 + BOX2

Voila! So now we have the result in the variable called RESULTBOX, was that easy or what?

But why is this important? Well we now see a very simple example with 2 numbers and with a simple operation, but what if we had to do different operations? We’ll save that for later. For now we need to understand that a variable is a box that contains data. You need to know something more, this box is a representation of actual computer MEMORY.

I bet you went to the store one day and the guy talked to you about memory and ram and gigabytes, well next time I’ll explain that too!

See ya!

Thursday 16 August 2012

Programming for beginners – part 2

And here we are again, thanks for coming back!.

I hope everything was clear last time we met, if not please comment and let me know. minifono-candy-for-ipad-from-totostudios

Today we are going to learn a few new things. First of all, on the right there’s a picture from my first app. I named it mini fono candy (or minifono for short).  My plan is to take you from absolutely no programming knowledge to being able to make an app like minifono.

Like I said, let’s go slowly first. When I first started programming there were not many options and I only had access to a very small computer called zx81. It was similar to a programmable calculators we use these days. But it really worked as a teaching tool and because it was so limited it made me think things twice.

My first game, back in 1983, was a horse racing game. It was very rudimentary but it served it’s purpose. There were 10 horses and you could bet on one of them. At the end of the race you could win or loose, easy.

So the first thing I needed to do was to make 1 horse. Remember last time I was talking about the visual representation, the pixel, right?. So first thing was making a horse. Back then I just put 3 squares together, because that’s was all available, period. Today I would do it differently. I would make a horse with a paint software.

So let’s say we have an image of a horse, we now tell the computer to put it on the screen. And then move it to the right. We repeat this step as many times as needed to complete the amount of horses in our race. At the end we check which one wins, if it’s our horse we then increment our reward. That’s fine but what this has to do with programming? Well, years later I went to school and actually learn how to program. There they taught me something very important. They taught me that I need to understand the problem before I try to solve it.

Minifono is an app that teaches the numbers from 0 to 9 in English and Spanish. Right, so what’s the problem here? Mmmh.

Let’s say this: every time I touch a button I need to hear the sound of that number. That’s it? Well yes but wait, that’s easy to say but how on earth do we do it?

Let’s isolate the problem a little bit. First of all we need to show the button, then assign an event (touch) and then assign a sound to that event. Do you get it? Ok, so then let’s start with what we call CODE. A code is a language that the computer understand. It’s also known as programming language. So we first need to learn it before we can command the computer to do such things.

For every object that we see on screen we need a referrer, something, like a tag on a t-shirt. We call this tag a variable. And we need it because we need to put some information in it. Put? similar to a TAG, tags have information written on it right? things like price, brand, size, etc, right? I feel illuminated now. So a variable is a tag, a container that has information in it. We need to name those tags, we are going to call button1 to the first tag. So now we have a variable called button1. This variable is not attached to anything right now but it will NEXT WEEK !

So please read this as many times as needed. See you next week!

Oh and if you need to download minifono just click on it’s name and it will take you to the App Store it’s FREE, if you don’t have an apple device you can still get it from the Barnes and Noble Store.

Thursday 9 August 2012

How to start programming for beginners

images I previously made a tutorial about how to make an iPad eBook, but, I received several comments saying that those tutorials are a little too difficult for someone who doesn't have any previous experience; so I decided to start from scratch and make a tutorial for really really beginners.

In other words, if you already programmed then this tutorial is not for you. On the other hand if you don't have any idea but you have a passion and you are willing to study and practice then this is for you.

I used to teach basic computer skills in the 90's and frequently found people who never ever touched a keyboard, so I designed ways to explain programming using some examples and analogies. At that time I used to ask this: What is a programmer? Do you have a washing machine at home? If so then you are a programmer already! Let me explain. A program is a series of steps that a computer has to follow. In this case a washing machine follows a series of steps such as, wash, rinse, etc. If you can see this then you are almost there.

Now you say that's really easy to see but how do I make a game such as Plants Vs Zombies? Whoa, hold on there! You need to start small and gradually get into more complex things. Think about this, what you see on your monitor is just a dot of light. Or should I say millions of them. That's all. You just interact with them via several different ways such as: keyboard, mouse, finger, etc. Those points of light on your screen are called pixels. Order them and you get an image. Presto. Then you can tell the computer to move that image. Or perhaps rotate it, or detect if it collided with another image. You see we start building the concepts little by little.

And this now looks more like an introduction to a book, and who knows maybe in the future it will be. For now let’s just get started.

So, we need to know how are we going to tell the computer what steps she needs to follow. But wait, is there a dial similar to a washing machine one? Nah. If there was one then computers would be very limited. So instead of a dial we have a keyboard. With it we can enter instructions. A set of instructions becomes a program. Easy right?. And a set of programs becomes an application, such as Word or Excell.

What we really need to do now is learn the language the computer uses;  what kind of structures we need, what kind of things or commands the computer is capable to perform. For instance, we would like to display a word or a sentence on the screen. How do we tell the computer to do that?  This kinds of things we will learn in these tutorials.

So for this first one I will tell you that we are going to learn a language called LUA. And for now that’s all you need to know about it.

To get ready for the next tutorial I want you to grab a notebook (a paper one), a pencil and eraser, that’s all. We need to write down some information before we proceed with the actual programming. Later you’ll have a summary of the commands that you can use.

See you next week!

AdrianEraldo

Friday 27 July 2012

What is a Spritesheet? (not a drink)

I have found this very interesting video and I wanted to share it with you. It’s about spritesheets, wait what?

contentsOk, a spritesheet is a big image file that contains smaller images inside. The reason behind this is to avoid having multiple images spread around the project directory and to save memory on the device. But enough introduction, here it is:

SpriteSheets video

Thanks Andreas Loew for letting me share this content.

Thursday 26 July 2012

P7 - How to make an iPad eBook with CoronaSDK

In this tutorial I’ll show you a demonstration on how to use a very important module called Director. This module was develop by Ricardo Rauber at his lab in Brazil. He created it to help the developer’s community and certainly he is doing a great job. Right now he is in version 1.4. if you want more information you should go to his page http://rauberlabs.blogspot.ca and take a look. The only sad things is that there is not available information for beginners, so that’s why I decided to give Ricardo a hand and try to explain a little more what is it about. I hope I’m doing a good job here, if not please let me know what would you like me to explain further.

But then how did I manage to understand it? Well there are some comments inside the module. And you can also run it and see how it works. So that’s about it. After that you need to implement it with your own code; and that’s how I teach myself.

If you are looking for my work you can visit my page: Interactive iPad Books for children on my other website. And if you are feeling thankful  please buy one of my apps.

So let’s get to it.

Wednesday 25 July 2012

Nook store nightmares...

As some of you may know publishing in the NOOK app store could be a nightmare.
First of all, if are a developer like me, you might want to look into this store since has a few but good features (that in another post).
So for now I want to warn you that applying is a nightmare. First all the questions, then the taxes even if you are publshing outside the US you still need to apply for an EAN.
As usual, if everything goes the way it goes in a perfect world then you don't have to worry. But if you live in the same world that I live then you are screwed.
All I want to say for now is that pay attention to every step. Specially in the tax application because if you misspelled the name of your street then the process is halted. In my case instead of just typing the number of my apartment there was the word UNIT in front. So for that reason my application was put in review mode.
Ok, that's it for now.
Cheers!