I have read close to 30 different tutorials now, but have got barely any further than where I was before, so I have come back to the place where I have got the best info from in the past....
I am, yet again, having some problems:
1) I have set up a variable to prevent my character from falling until the first swipe has been detected:
Code:
@interface: BOOL firstSwipe
@property (nonatomic, assign) BOOL firstSwipe;
- (void)viewDidLoad {
firstSwipe = false; }
-(void)moveBlocks {
if(gameState == kGameStateRunning) {
if (firstSwipe = true) {
character.transform = CGAffineTransformTranslate(character.transform, 0.0, 15.0); }
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if(gameState == kGameStateRunning) {
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.view];
if (fabsf(startTouchPosition.x - currentTouchPosition.x) >= HORIZ_SWIPE_DRAG_MAX &&
fabsf(startTouchPosition.y - currentTouchPosition.y) <= VERT_SWIPE_DRAG_MIN)
{
if (currentTouchPosition.y > startTouchPosition.y) {
[self characterJump];
firstSwipe = true; } }
But my character falls whether the first swipe has happened or not!
2) How do I make the the blocks continue to fall when they reach the bottom of the screen or each other (instead of just stop) to simulate that the screen is moving (I tried changing the
Code:
if (newCenter.y > 420 || [self isTouchingStoppedBlock:block]) {
if (stoppedBlocks==nil){
stoppedBlocks = [[NSMutableArray alloc] init];
}
newCenter.y = newCenter.y -10;
to newCenter.y -5 but it didn't do anything)?
The only thing I have done successfully is to make the character jump!
Thanks for all your help
Cam