Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoffan committed Feb 14, 2012
1 parent df11dc3 commit 5c0ca8e
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 155 deletions.
322 changes: 187 additions & 135 deletions Professor Bombing.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Professor Bombing/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Copyright __MyCompanyName__ 2012. All rights reserved.
//

#import "cocos2d.h"

#import "AppDelegate.h"
#import "GameConfig.h"
#import "HelloWorldLayer.h"
Expand Down
5 changes: 1 addition & 4 deletions Professor Bombing/HelloWorldLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
// Copyright __MyCompanyName__ 2012. All rights reserved.
//


// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"

// HelloWorldLayer
@interface HelloWorldLayer : CCLayer
{
NSMutableArray *facesArray;
}

// returns a CCScene that contains the HelloWorldLayer as the only child
Expand Down
85 changes: 73 additions & 12 deletions Professor Bombing/HelloWorldLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,85 @@ +(CCScene *) scene
return scene;
}

- (void)animateAtIndex:(int)index
{
CCSprite *tmp = (CCSprite *)[facesArray objectAtIndex:index];
int x = tmp.position.x;
id move = [CCMoveTo actionWithDuration:5 position:ccp(x, 240)];

[[facesArray objectAtIndex:index] runAction:move];

index++;
}

- (void)waitTime:(unsigned)time
{
sleep(time);
}

- (void)animAll
{
for (CCSprite *i in facesArray) {
CCAction *action = [CCSequence actions:[CCMoveTo actionWithDuration:i.tag position:ccp(i.position.x, 0)],
[CCDelayTime actionWithDuration:100], nil];
// sleep(2);
[self runAction:[CCDelayTime actionWithDuration:2.5]];
[i runAction:action];
}
}

// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

// create and initialize a Label
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

// ask director the the window size
CGSize size = [[CCDirector sharedDirector] winSize];

// position the label on the center of the screen
label.position = ccp( size.width /2 , size.height/2 );

// add the label as a child to this Layer
[self addChild: label];

CCLayer *layer = [CCLayerColor layerWithColor:ccc4(255, 255, 255, 255) width:480 height:320];
[self addChild:layer];


// CCSprite *d = [CCSprite spriteWithFile:@"face.png"];
// d.scale = 0.5;
// d.anchorPoint = ccp(0, 0);
// d.position = ccp(240, 160);
// [self addChild:d];


// CGSize winSize = [[CCDirector sharedDirector] winSize];
facesArray = [[NSMutableArray alloc] init];
for (int i = 0; i < 100; ++i) {
CCSprite *face = [CCSprite spriteWithFile:@"face.png"];
face.anchorPoint = ccp(0, 0);
face.scale = 0.1;
face.position = ccp(arc4random() % 450, 320 + (i * 20));
face.tag = i;
[facesArray addObject:face];
[self addChild:[facesArray objectAtIndex:i]];

// [self animateAtIndex:i];
}

[self animAll];

// [self schedule:@selector(animAll) interval:2.0];

// CCAction *action = [CCCallFunc actionWithTarget:self selector:@selector(animAll)];
//
// [self runAction:action];
//
//
// // create and initialize a Label
// CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];
//
// // ask director the the window size
// CGSize size = [[CCDirector sharedDirector] winSize];
//
// // position the label on the center of the screen
// label.position = ccp( size.width /2 , size.height/2 );
//
// // add the label as a child to this Layer
// [self addChild: label];
}
return self;
}
Expand Down
1 change: 1 addition & 0 deletions Professor Bombing/Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#endif
2 changes: 0 additions & 2 deletions Professor Bombing/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// If you want to support iAd, use this class as the controller of your iAd
//

#import "cocos2d.h"

#import "RootViewController.h"
#import "GameConfig.h"

Expand Down
Binary file added Professor Bombing/face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5c0ca8e

Please sign in to comment.