Cocos2d-iPhone and a start
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 20×20px grid working in my touch layer of the game so that a touch within a certain 20×20px 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 20×20px 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.
Popularity: 24% [?]

Leave your response!