Today was another fun day in the iphone programming class. We started off by continuing our Tribble project. The first thing we did was make the little tribbles disappear when we touched them. All of a sudden, everyone started playing games against each other to see who could delete them the quickest. When we started playing the game though, the Tribbles were multiplying way too quickly, so the frame rate dropped tremendously and we could not play the game. We fixed a couple of things and the Tribbles stopped reproducing as quickly. Finally, we were finished with the Tribble project. It was my favorite one so far, I had a great time doing it, and the end product was amazing. I am even going to go in tomorrow morning and have Mr. Howe put it on my phone for me so I can show it to my friends! For the last 5 minutes of the first period, Mr. Howe gave us a new assignment: we have to work by ourselves to make our own app with a spaceship, a bullet, and a monster! I started off by importing them into XCode, then the bell rang and I was off to lunch.
We went back to class and continued where we had left off. It was hard for me because there were so many specific details that we needed to input, but since we had to try to work by ourselves, I was not sure if I was doing it right. After I thought I was ready with the plane in the app, I test ran it and was astonished with what I saw. I had 9 errors! I went back and fixed up the errors (which took a while) and the app ran! All I had though was a plane on the left side of my screen, and there were 5 minutes left in the class. Right then, Mr. Howe said that he would help everyone out by getting everyone up to date with whats going on tomorrow, which relieved me of my stress. I was happy I was not going to be behind anymore, and grateful for what Mr. Howe said.
The class is going very well and I am having a great time learning about apps. I am a little bit confused though on why we need so many .h and .m files, instead of just having one hello world thing?
In the old days, (back when I was young...), a lot of programmers would happily write whole programs in one file. (I did that a lot in high school.) But people quickly discovered that it quickly became unwieldy searching for things in files that were thousands of lines long!
ReplyDeleteAs new languages were invented, something called "object oriented programming" became fashionable - tying code to things. If you are writing code to make the playerShip have a sprite show up on the screen, keep that with the playerShip stuff - don't make me look through the enemyShip stuff.
For us, this means that behavior that is specific to one type of thing gets put in the class for that type of thing. Stuff associated with getting the program started and with things interacting with each other goes into the "HelloWorldScene" class.