Iphone Developer Technological

Box2D – Cocos2d – ObjC Complex Code Design

I got lost with a few kinks added in C10 and the vector stuff and c++ stuff in Ch11.  
So Id like to review what is happening by the time we get to the cart that you can move via the accelerometer.

1.  Before we only needed to add a cocos2d scene and then a layer to make a screenful of action.  
With Box2D we must still create a Scene and Layer but we add the C++ format of Class.h & 
instead of just .m.  We also added a query callback C++ Class that serves the specific purpose of 
cycling through all bodies in the [b]box2d world? or something[/b], and tests if there is an intersection, 
much like in our original cocos2d intersection tests.

2.  We created a base Box2DSprite class in order to give our Box2D bodies a basic blueprint.  
It states they all have a body which is settable as a property, inherit from the GameCharacter class 
(which inherits from GameObject giving it a changeState & updateStateWithDelta) and they could have a mouseJoint.

3.  In PuzzleLayer we just had a PuzzleLayer Class that created all Box2D objects internally with 
the bunch of methods createMeteor etc.  In Scene4 however, we created a specific Box2D body class, Cart, which has moved 
a lot of its own creation-code to its class file,  The cart class has its init method plus a createsBodyAtLocation, a
create the wheels with sprites & a setsMotorSpeed method!
The fact that we outsourced some code differently from the PuzzleLayer is throwing me off.  Specifically this part:

sprite.body = body;

I understand that before, we passed in a specific sprite to the createBodyAtLocation method when creating 
i.e., the Meteor.  So we could say, that sprite I just passed in, set my new body's userData to it and at the same time, 
set my newly created body to that sprite's body {since any sprite derives from the Box2DSprite class we created}.  
We then added it to the sceneSpriteBatchNode in the same method.  
Calling the Meteor node got the png from the sharedSpriteFrameCache setting the Meteor's DisplayFrame 
to that png.  Then I ran across:


1) Self instead of sprite because now is its own class, its own object.

2) We are getting a pointer to the box2d body for later use in the sensor detecting method.

To understand self one must go to the init call, which in this case is initWithWorld.  
Ok, so here we setDisplayFrame to cart, since this is the cart class.  
We then say createBodyAtLocation which does the body and fixture setup.  
So i kinda see where body->SetUserData(sprite); = body->SetUserData(self);  
I believe the problem is that from Chapter 10 on, the detailed explanations of everything ceased, notably.
Also it seems many lines of code are included in one listing, for later use down the line in that chapter.

For example; the listOfGameObjects?  Later in Chapter 11 we run into something similar in the ccTouchBegan & Moved methods.
And the  kVikingSpriteTagValue is also added in the earlier code without an explanation.  
It is used to reference the cart in the final Chapter 12 scene.  They are added with some code that is not particularly used because the cart is not moved by touch, it is moved by the accelerometer.
Philosophical Technological

Power Hungry Devices

Its funny how capitalism leads to consumerism and that it turn, in a free democratic society, is fueled by our “NEED” for more and more services.  What this translates to is the fact that we want more and more “things” which we request from our technology.  So everyday we come up with things we want our phone to do for us.  First, the beeper simply sent us text messages for us to get to a landline and call.  Then it allowed us to answer text messages.  Soon after came the cellular phone and we didn’t have to go to a landline, we could simply call on the mobile phone.  But then we realized we had too many friends and so we asked for speed dial.  Then we realized it would be good to keep certain info of those contacts on the device so we got Address Books for quick and easy access.  As computers matured, we got more computer like functionality such as calculators, cameras and other such features on our mobiles.  Once the internet came of age, we demanded internet service on the phones which as the internet itself evolved, that internet-like functionality of mobile phones has gotten more complex.  Yet we are still disappointed by the fact that our battery now lasts half as much as it did back then, when mobile phones were nothing more than a couple of “stringless” cans!

I just came across this article; where users are complaining about battery life on the latest iPhone 4S.  The funny thing is that the very technology which has made us impatient and insatiable with response-time to our user requests, the internet and its related technologies such as computers, is the one responsible for our disappointment in how that technology behaves.

Yet the answer does not lie in that industry, for the infamous portable energy problem has affected so many other industries that have been unable to find a better solution for it.  Moreover, the portable energy problem is what shaped humanity as we know it today.  Think about it, since the nomads roamed the earth, their whole purpose in life was to follow a moving source of energy, food!  They decided to settle down and start building a more stable homestead but they soon learned that home had to be near some sort of energy depot, which is why most main cities are built near rivers or ports.  So we settled for quite some time and were happy having done so.  Nowadays we find ourselves roaming again but this time we want to take our energy sources with us instead of following them around.

It has been quite some time since so many other industries have tried to solve this problem:

1) Airplanes need weightless and endless fuel to travel longer without the weight of the fuel itself to bog them down.

2) Space travel is limited because such a powerful fuel source contained in a small enough space is non-existent or non-portable.

3) Solar power can sure be harnessed but not stored in any one container enough to power houses reasonably.

4) Our own bodies still need to eat 2 to 3 times a day if not more.

5) And now our phones which prove to become evermore complex, need the lightest and longest lasting energy source.


Can the mobile communications industry be the drop that will spill the idea jar on how to solve this problem?

Iphone Developer

iOS5 Important Features from 200+ available

I’ve reviewed the latest features on the latest iOS5 on many sites and found over 200 out of which only some are really useful to me.  Id like to share the ones I found most important:

1) Swiping a notification will open the relevant app

2) The fact that those notifications are non-obtrusive to YouTube videos

3) Reminder, Calendar, Contacts, Mail, Photo and Doc Integration to iCould because Gmail makes a mess

4) Twitter Integration

5) Open Camera from lock screen although picture taking with the Vol+ button is only for the 4S I think

6) Cropping, Rotating, Organizing and Red-eye removal on pics directly

7) OTA syncing & Delta updating (updates wirelessly only new OS files)

8) Email flagging

9) Split Keyboard for iPad sounds very handy

10) Keyboard shortcuts (make iOS convert your OMG into Oh My God or whatever you need) – very handy

11) LED Flash for alerts now

12) Custom tones, rings and vibrations! per contact

13) Open Safari links in background.  This is awesome!

14) Delete individual recent calls

15) Organize music

16) Custom Touch Gestures!

17) Select & Mark multiple emails as read at once

18) Custom Dictionary for learning new words

19) Notification Alerts in mail app if you forgot to add title

20) iMessage of course

21) Faster Safari loading

22) Mail inbox gesture navigation for multiple email accounts

23) Friends and Family sonar 🙂

24) Speak to Siri & other speak text options

Translate »