headline »
Sat, 3/07/10 – 18:18 | No Comment

Well I can go back slightly on what I said about moving sucking, I don’t so much mind the moving side of things, it was the leaving all my friends in Lincoln that sucked so …

Read the full story »
Audio

Anything related to my audio and music work will be in here, including anything related to ProTools or Logic Pro

Life

Anything relating to general life, everything in this section is my own views

Software Development

Anything related to my development work on iPhone SDK, OS X, using objective-c, cocoa, and cocoa touch.

University

Anything related to my university course, work, and dissertation. Anything expressed in this section is my own thoughts on the matter.

Web Development

Anything related to my web development work, updates related to this site, or anything web related

Home » Featured, Software Development, University

Cocos2d-iPhone and a start

Submitted by Adam Boardman on Sunday, 10 January 20102 Comments

Well during Christmas and my holiday break at my parents I did a fair bit of reading up on iPhone development, and game development for mobile devices, iPhone in particular. I got a new book which I have only skimmed through so far but seems pretty interesting and has some good ideas in it which should help during the production of my app.

I have started to get the hang of using Xcode after using it for a longer time now. I’m not overly keen on the Interface Builder however as I’m using Cocos2d-iPhone I shouldn’t need to make much use of Interface Builder. I feel that after really learning how it all works and what does what then it is a really powerful tool, however currently it just seems to be quicker for me to hand-code what I’m trying to do. This could be a stupid idea on my part but only time will tell.

My application has started to take shape finally after a few weeks of sitting in a state where I could register taps on the screen as screen co-ordinates in console, which seems to be pretty much game development 101 sort of stuff. Now moving on a bit from that I have (with a bit of back down to earth help from my dad) managed to get a virtual 20x20px grid working in my touch layer of the game so that a touch within a certain 20x20px cell is registered as one location on screen, for example, if a user touched the screen at screen co-ordinates (3,19) then that would be cell (1,1) in the console, however if a user touches (25,19) then that would be grid cell (2,1).

This has taken me a while to get working as for some reason I completely forgot that screen co-ordinates are only numbers, and there can only be a certain amount of pixels on the screen, once my dad had reminded me of this fact I was away and could finally get my grid working. Currently the only thing it can do is log the start location, end location, and also track a drag through the grid cells to the console.

The next step for me is to get a 20x20px sprite to stick to the location where the user has tapped but to use the grid cell as its reference, for example, if cell (1,1) is screen co-ordinate (0-19, 0-19) and a user touched (13, 5) then the sprite would not use (13, 5) as its anchor point, but instead will use (0, 0) as its anchor, sprites should anchor from the bottom left corner using this method. Once I have a single sprite working I will then look into getting multiple sprites working at once, and then onto tracking a drag work either placing a sprite or removing an instance of one depending on where the user has dragged their finger.

Once I have this working I’ll actually get around to posting some example code in a short post soon.

Tweet This Post

Popularity: 11% [?]

2 Comments »

  • KirlRomolor said:

    Hey im fresh on here, I came accross this site I have found It incredibly accommodating and its helped me loads. I should be able to give something back & guide others like it has helped me.

    Cheers all, Catch You Later.

  • iSatori Morph Megadrive said:

    Hola! I came across your web site while i was on Yahoo researching some recent Twitter trends to discover what’s been popular recently. Hung around a little to check things out and read a few of your articles… first rate stuff. I will be sure to return in the future some time and catch up.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.