Saturday, June 30, 2012

63 days before the last day of my job

So time is flying but I am still stuck at the first tutorial because I cannot proceed if I cannot understand the code, just doing copy paste is not helping much

so my today goal is try to understand what the meaning of each of the complicated file

there is a helloworld.h and helloworld.m

the .h seem like is declare what is the classes and .m contain all the method and function

but i still cannot understand how the entire stuff running

on my helloworld.h i have 2 interface
===========================

@interface helloworld:CCColorLayer

@interface HelloworldScene: CCScene

( I am just guessing we need a scene, inside the scene we have a layer)

on my helloworld.m i have 2 implementation with 10 function
===========================================
@implementation HelloworldScene
-(id)init
-(void)dealloc

(I am guessing one is for initialize and one is for deallocate memory)

@implementation HelloWorld
-(void)spriteMoveFinished:(id)sender
-(void)addTarget
-(void)gameLogic:(ccTime)dt
-(id)init
-(void)update:(ccTime)dt
-(void)pauseGame
-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
-(void)dealloc

(this one complicate out of me, there are 8 method inside the implementation of hello world, but which one of the method is the timer? i am guessing is the update???? let me check the code inside)

ok, after 2 minutes of reading,

i found inside the -(id)init there is 2 line of scheduling code


// Call game logic about every second
[self schedule:@selector(gameLogic:) interval:1.0];
[self schedule:@selector(update:)];

i guess this is the way it run the timer, every single second it will call the method "gamelogic and also "update"


the (void)gameLogic will calling the (void)addTarget every single second, and (void)addTarget will create an enemy every single second by first declaring the

CCSprite *target = [CCSprite spriteWithFile:@"Target.png" rect:CGRectMake(0, 0, 27, 40)]; 

target.position = ccp(winSize.width + (target.contentSize.width/2), actualY);
[self addChild:target];

notice all this SELF stuff is very confusing i guess you need to memorize them


inside the (void)update there are 4 for loop i guess is to loop through all the stuff every single second
for (CCSprite *projectile in _projectiles) {

              for (CCSprite *target in _targets) {}
}

for (CCSprite *target in targetsToDelete) {}

for (CCSprite *projectile in projectilesToDelete) {}




But I cannot found the code part of enemy movement and projectile movement inside the (void)update method i guess the code must be somewhere

after 2 minute of searching, i found this two code inside the (void)addTarget and (void)ccTouchesEnded


// Create the actions
id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2, actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
[target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];


// Move projectile to actual endpoint
[projectile runAction:[CCSequence actions:
  [CCMoveTo actionWithDuration:realMoveDuration position:realDest],
  [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)],
  nil]];


Seem like the object CCSprite have its own runAction which will move auto once you set it

ok


So it only mean one thing, the (void)update is only used as a collision detection


first it loop the projectile, for each projectile it check is it collide with the target, if yes, remove both the projectile and the target


ok, i can understand 80% to 90% now, so can move along to the next tutorial






Tuesday, June 26, 2012

Following tutorial on coco2d

So I am following tutorial from http://www.raywenderlich.com/352/how-to-make-a-simple-iphone-game-with-cocos2d-tutorial

and here is what i get, pretty cool, even though i only able to understand 50% of the code, still very blur but i gain little confidence already, hooray


Noob Guide to install cocos2d

After a search on google, i decided to build my game base on cocos2d template

since they provided the following features

  • Scene management (workflow)
  • Transitions between scenes
  • Sprites and Sprite Sheets
  • Effects: Lens, Ripple, Waves, Liquid, Twirl, etc.
  • Actions (behaviors):
    • Trasformation Actions: Move, Rotate, Scale, Jump, etc.
    • Composable actions: Sequence, Spawn, Repeat, Reverse
    • Ease Actions: Exp, Sin, Cubic, etc.
    • Misc actions: CallFunc, OrbitCamera
  • Basic menus and buttons
  • Integrated Box2d and Chipmunk physics engine
  • Particle system
  • Text rendering support
  • Texture Atlas support
  • Tile Map support
  • Parallax scrolling support
  • Streak Motion support
  • High Score server (Cocos Live)
  • Touch/Accelerometer support
  • Sound support
  • Portrait and Landscape mode
  • Integrated Pause/Resume
  • Supports PowerVR Texture Compression (PVRTC) format
  • Language: objective-c
  • Open Source: Compatible with open and closed source projects
  • OpenGL ES 1.1 based
It is super cool

anyway, for a total noob, how do you install it right?

1. go to http://code.google.com/p/cocos2d-iphone/
2. click the download link on the left hand side, click the cocos2d-iphone-2.0-rc2.tar.gz 
3. after download finish, click the download arrow on your top right safari then double click to extract
4. click the magnifying glass to see where it land, 
5. press F4 on your keyboard to open up the application menu, click utilities, click terminal 
6. inside terminal ,go into the folder you have extract 
-  you can check where you are by typing pwd
-  to change directory, type cd <your directory>
-  to see the file under your current directory, type ls
7. install it by typing ./install-templates.sh -f


hopes it help

65 days before the last day of my job

i got 65 days left before the last day of my job and I hope i can at least get something going before I don't have any income

best case scenario is i hope i can publish the game before the last day of my job

I am just home from my day job and even though I am very tired I must force myself to learn Xcode

today objective is that I must learn how to use the view to display my hero and move my hero using touch screen

also why the hell blogspot is sooooo super bad with 0 page view and no one came to read my blog???? sigh

Sunday, June 24, 2012

complete my first tutorial

so i finish my first tutorial with probably 10% understanding what is actually going on,

it is very difficult indeed, so many button to click and so many different file and different code and different syntax

do note i learn java before and code for android but not Xcode, this is very challenging indeed


From Start to Finish, how long will it take for noob?


From Start to Finish, How long will it take?

I am still at the introduction stage, not even installing, i hope i can done it all before the last day of my 9-6 job?????

i got 2 months left before I am jobless, So i must push myself to the limit and finish an app as fast as possible?

Watching iOS Development Videos

Well, I guess the very first thing every noob developer can do is to watch all the iOS development videos

there are total of 36 video hopefully it won't take me 36 hour to finish it

after a quick check, each video is approximately 1 hour long, so i guess a 36 hour is a must

if i can dedicate 3 hours a day to watch all of the video it will take me 10 days just to finish it,

if i can dedicate 8 hours a day to watch all of the video it will take me 5 days just to finish it

really need good patient for this

My Inpiration Blog

Here I want to share a blog that inspired me to quit my job and do this full time

it is located at

http://www.streamingcolour.com/blog/

Owen also quit his job and do it full-time, his games have been featured on the appstore and I think he is surviving very well for doing what he loved to do


How to Transfer File From iPhone to Imac for Noob

Here is a simple guide of how to transfer file from iPhone to iMac, well,

first, go to iTunes and sync your phone to your iMac pro, you can click sign in on the top right then click on that top, under store, click authorize this computer

second, Click iPhoto on the bottom of your computer, then you can import all your photo from your iPhone into your iMac,

Hopes it help, i spend a well 30 minutes to figure it out myself

Using the IMAC the First Time part 2

After 30 minute of searching and googling and sync iPhone to the iTunes and authorize computer and all that stuff

I am still unable to transfer photo from iPhone to iMac, what kind of design is this? Did they do it on purpose?

Finally I am found it, it is under the IPHOTO

later i will write a post to help other Noob iMac user

and below is the photo of my IMAC PRO


Using the IMAC the First Time part 1

Boy it is so difficult, i came back from work and start to work on my iMac

i spend a whole 5 minute to figure out how to plug in the power source

then I am launching up the safari to write this post, I would like to upload photo of my iMAC pro that i have taken using my iPhone but i don't know how

I will google it and hopefully able to post it soon

a full 20 minute google search unable to let a noob like me to transfer photo to the iMac, i go dinner first, come back in a while

Saturday, June 23, 2012

Buying Imac

Yeah, forgot to say to start building an iphone app or ipad app, you need to have imac, normal computer  cannot work because the OS is in MAC

so yeah, the first thing i do is to spend money buying IMAC PRO

i already have 2 IPHONE and 1 IPAD so i dont need to buy those item again

ok, so when can I start? hmmmmm, too bad I need to work for my boss tomorrow, yeah, you heard it right, I need to go to work on sunday

didnt i already said my current job is very stressful and long working hour

something like 7am leave home, go home at 9pm , around 14 hour per day including the transport

sometimes we need to work on saturday+ sunday

this sunday no luck, need to go work on the morning

so I try my best to start to touch my imac on sunday night if possible


not to mention i know nothing about imac and nothing about XCODE

pray hard to god, I need luck and stamina to do this



Sending resignation letter

I just send out my resignation letter to my boss, and boy how pissed he is, I have been loyal to him for many years and he think i will continue to work for him for the next 30 years. But Sorry, I got to try something out some point in my life, sorry boss

The bad news is, I need to give 2 month notice, so i can only totally quit on 31 august 2012,

The good news is, I can have another 2 months of salary, which is 14000

i got around 50k savings and my monthly expense is 2.5k, without income, i can last for 2 years???? perhaps?


Quit My Job to build an Iphone App?

Sounds Crazy???? YES, IT IS CRAZY!!!!!!!

what is the odd of success??? 0.00000005% or lower

what is the difficulty compare with current job? 100x or 1000x harder??????

And why the hell I still wanna do it?????

to gamble it

YES, I have been working for 10 years as a programmer and My salary is high, but I am very tired , mentally tired because I need to work long working hour in a very boring and unmotivated job, thinking of which i need to work for another 30 or 40 years with 0 chance of becoming rich and no chance to do what i really like

and so, I am gamble it big,

this will be my blog and record of my personal feeling, for those of you who want to try it out but do not have the courage to do it just follow along, and if i fail miserably you all can laugh and think to yourself that you are lucky you did not quit your job

I need to say it first, I think i only have 0.00000000000005% chance of success but i will do my very very very best

additional note, I have never used an imac and never code in xcode before, the difficulty is like mountain, wish me luck , and bye

Fifi