Permalink
Browse files

first commit

  • Loading branch information...
oscardelben committed May 2, 2011
1 parent b77895d commit 2af82c3008ae8e4d597fe358bdd247c302b3c9a6
View
@@ -0,0 +1,45 @@
+# taken from http://blog.illuminex.com/2009/10/better-sample-gitignore-file-for-xcode.html
+
+# Mac OS X Finder and whatnot
+.DS_Store
+
+
+# Sparkle distribution Private Key (Don't check me in!)
+dsa_priv.pem
+
+
+# XCode (and ancestors) per-user config (very noisy, and not relevant)
+*.mode1
+*.mode1v3
+*.mode2v3
+*.perspective
+*.perspectivev3
+*.pbxuser
+
+# Xcode 4 http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
+xcuserdata
+
+
+# Generated files
+VersionX-revision.h
+
+
+# build products
+build/
+*.[oa]
+
+# Other source repository archive directories (protects when importing)
+.hg
+.svn
+CVS
+
+
+# automatic backup files
+*~.nib
+*.swp
+*~
+*(Autosaved).rtfd/
+Backup[ ]of[ ]*.pages/
+Backup[ ]of[ ]*.key/
+Backup[ ]of[ ]*.numbers/
+
View
1 Readme
@@ -0,0 +1 @@
+Coming Soon...

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -10,7 +10,7 @@
#import "AppDelegate.h"
#import "GameConfig.h"
-#import "HelloWorldLayer.h"
+#import "SnakeLayer.h"
#import "RootViewController.h"
@implementation AppDelegate
@@ -110,7 +110,7 @@ - (void) applicationDidFinishLaunching:(UIApplication*)application
[self removeStartupFlicker];
// Run the intro Scene
- [[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
+ [[CCDirector sharedDirector] runWithScene: [SnakeLayer scene]];
}
View
@@ -24,5 +24,17 @@
//
#define GAME_AUTOROTATION kGameAutorotationUIViewController
+#define kRows 20
+#define kColumns 30
+
+#define kCellWidth 15
+
+#define kXOffset 10
+#define kYOffset 15
+
+#define kMoveUp 1
+#define kMoveRight 2
+#define kMoveDown 3
+#define kMoveLeft 4
#endif // __GAME_CONFIG_H
@@ -10,15 +10,6 @@
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
- <key>Icon files</key>
- <array>
- <string>Icon.png</string>
- <string>Icon@2x.png</string>
- <string>Icon-72.png</string>
- <string>Icon-Small-50.png</string>
- <string>Icon-Small.png</string>
- <string>Icon-Small@2x.png</string>
- </array>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -31,18 +22,31 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
+ <key>Icon files</key>
+ <array>
+ <string>Icon.png</string>
+ <string>Icon@2x.png</string>
+ <string>Icon-72.png</string>
+ <string>Icon-Small-50.png</string>
+ <string>Icon-Small.png</string>
+ <string>Icon-Small@2x.png</string>
+ </array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
<true/>
- <key>UIStatusBarHidden</key>
- <true/>
<key>UIRequiredDeviceCapabilities</key>
<dict>
<key>accelerometer</key>
<true/>
<key>opengles-1</key>
<true/>
</dict>
+ <key>UIStatusBarHidden</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
</dict>
</plist>
@@ -45,6 +45,8 @@ - (void)viewDidLoad {
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return NO;
+
//
// There are 2 ways to support auto-rotation:
// - The OpenGL / cocos2d way
View
@@ -0,0 +1,22 @@
+//
+// SnakeCell.h
+// Snake4iPhone
+//
+// Created by Oscar Del Ben on 5/2/11.
+// Copyright 2011 DibiStore. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "cocos2d.h"
+
+@interface SnakeCell : NSObject {
+
+}
+
+@property (nonatomic, retain) SnakeCell *parentCell;
+@property (nonatomic, assign) int column;
+@property (nonatomic, assign) int row;
+
+- (CCSprite *)spriteRepresentation;
+
+@end
View
@@ -0,0 +1,48 @@
+//
+// SnakeCell.m
+// Snake4iPhone
+//
+// Created by Oscar Del Ben on 5/2/11.
+// Copyright 2011 DibiStore. All rights reserved.
+//
+
+#import "SnakeCell.h"
+#import "GameConfig.h"
+
+@implementation SnakeCell
+
+@synthesize parentCell;
+@synthesize column;
+@synthesize row;
+
+- (id)init
+{
+ self = [super init];
+ if (self)
+ {
+ //
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [parentCell release];
+ [super dealloc];
+}
+
+- (CCSprite *)spriteRepresentation
+{
+ CCSprite *sprite = [CCSprite spriteWithFile:@"snake-body.png"];
+
+ float x = kCellWidth * column + kXOffset;
+ float y = kCellWidth * row + kYOffset;
+
+ sprite.anchorPoint = ccp(0, 0);
+ sprite.position = CGPointMake(x, y);
+
+ return sprite;
+}
+
+@end
View
@@ -0,0 +1,23 @@
+//
+// SnakeLayer.h
+// Snake4iPhone
+//
+// Created by Oscar Del Ben on 5/2/11.
+// Copyright 2011 DibiStore. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "cocos2d.h"
+
+@interface SnakeLayer : CCLayer {
+}
+
+@property (nonatomic, retain) NSMutableArray *snake;
+@property (nonatomic, retain) NSMutableArray *drawnCells;
+@property (nonatomic, retain) NSNumber *nextMovement;
+@property (nonatomic, retain) NSMutableArray *currentPosition;
+
++(CCScene *) scene;
+
+@end
Oops, something went wrong.

0 comments on commit 2af82c3

Please sign in to comment.