-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Josh Aburto
committed
Sep 30, 2009
0 parents
commit beaeeb2
Showing
175 changed files
with
31,200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pbxproj -crlf -diff -merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# xcode noise | ||
build/* | ||
*.pbxuser | ||
*.mode1v3 | ||
|
||
# old skool | ||
.svn | ||
|
||
# osx noise | ||
.DS_Store | ||
profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// Tetromino.h | ||
// Tetris | ||
// | ||
// Created by Joshua Aburto on 9/26/09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "cocos2d.h" | ||
|
||
|
||
@interface Block : Sprite { | ||
int boardX, boardY; | ||
BOOL stuck; | ||
BOOL disappearing; | ||
|
||
|
||
} | ||
|
||
@property int boardX; | ||
@property int boardY; | ||
@property BOOL stuck; | ||
@property BOOL disappearing; | ||
|
||
+ (Block *)newBlock:(int)blockType; | ||
- (void)moveUp; | ||
- (void)moveDown; | ||
- (void)moveLeft; | ||
- (void)moveRight; | ||
|
||
@end | ||
|
||
#define COMPUTE_X(x) (abs(x) * 24) | ||
#define COMPUTE_Y(y) (456 - (abs(y) * 24)) | ||
#define COMPUTE_X_Y(x,y) ccp( COMPUTE_X(x), COMPUTE_Y(y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// | ||
// Tetromino.m | ||
// Tetris | ||
// | ||
// Created by Joshua Aburto on 9/26/09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "Block.h" | ||
|
||
@interface Block (private) | ||
|
||
- (void)initializeDefaults; | ||
- (void)redrawPositionOnBoard; | ||
|
||
@end | ||
|
||
@implementation Block | ||
|
||
@synthesize boardX; | ||
@synthesize boardY; | ||
@synthesize stuck; | ||
@synthesize disappearing; | ||
|
||
+ (Block *)newBlock:(int)blockType | ||
{ | ||
NSString *filename = nil, *color = nil; | ||
Block *temp = nil; | ||
|
||
switch (blockType) { | ||
case 0: | ||
color = @"red"; | ||
break; | ||
case 1: | ||
color = @"blue"; | ||
break; | ||
case 2: | ||
color = @"orange"; | ||
break; | ||
case 3: | ||
color = @"yellow"; | ||
break; | ||
case 4: | ||
color = @"magenta"; | ||
break; | ||
case 5: | ||
color = @"cyan"; | ||
break; | ||
case 6: | ||
color = @"green"; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
if (color) { | ||
filename = [[NSString alloc] initWithFormat:@"%@.png", color]; | ||
temp = [[self spriteWithFile:filename] retain]; | ||
[filename release]; | ||
|
||
[temp initializeDefaults]; | ||
|
||
} | ||
return temp; | ||
|
||
} | ||
|
||
|
||
- (void)initializeDefaults | ||
{ | ||
[self setAnchorPoint: ccp(0,0)]; | ||
[self setPosition: ccp(0,0)]; | ||
[self setOpacity:255]; | ||
[self setStuck:NO]; | ||
[self setDisappearing:NO]; | ||
[self setBoardX:0]; | ||
[self setBoardY:0]; | ||
} | ||
|
||
- (void)redrawPositionOnBoard | ||
{ | ||
[self setPosition: COMPUTE_X_Y(boardX, boardY)]; | ||
} | ||
|
||
- (void)moveUp | ||
{ | ||
boardY -= 1; | ||
[self redrawPositionOnBoard]; | ||
} | ||
|
||
- (void)moveDown | ||
{ | ||
boardY += 1; | ||
[self redrawPositionOnBoard]; | ||
} | ||
|
||
- (void)moveLeft | ||
{ | ||
boardX -= 1; | ||
[self redrawPositionOnBoard]; | ||
} | ||
|
||
- (void)moveRight | ||
{ | ||
boardX += 1; | ||
[self redrawPositionOnBoard]; | ||
} | ||
|
||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// GameLogicLayer.h | ||
// Tetris | ||
// | ||
// Created by Joshua Aburto on 9/26/09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "Tetromino.h" | ||
#import "Block.h" | ||
#define kLastColumn 9 | ||
#define kLastRow 19 | ||
|
||
@interface GameLogicLayer : Layer { | ||
enum touchTypes { | ||
kNone, | ||
kDropBlocks, | ||
kBlockFlip, | ||
kMoveLeft, | ||
kMoveRight | ||
} touchType; | ||
|
||
Block *board[kLastColumn + 1][kLastRow + 1]; | ||
Tetromino *userTetromino; | ||
int frameCount; | ||
int moveCycleRatio; | ||
int difficulty; | ||
int score; | ||
Label *scoreLabel; | ||
Label *difficultyLabel; | ||
|
||
|
||
} | ||
|
||
|
||
- (void)updateBoard:(ccTime)dt; | ||
|
||
@end |
Oops, something went wrong.