Skip to content

Instantly share code, notes, and snippets.

- (void)hideButton {
self.hitMeButton.hidden = TRUE;
self.loseLifeButton.hidden = TRUE;
self.addTimeButton.hidden = TRUE;
}
- (IBAction)pressResetButton:(UIButton *)sender {
if (!playing) {
highScore = 0;
score = 0;
[[NSUserDefaults standardUserDefaults]
setObject:[NSNumber numberWithInt:highScore]
forKey:@"highScore"];
}
[self updateLabels];
}
- (void)updateLabels
{
self.highScoreLabel.text =
[NSString stringWithFormat:@"High Score: %d",highScore];
self.scoreLabel.text =
[NSString stringWithFormat:@"Score: %d",score];
self.livesLabel.text =
[NSString stringWithFormat:@"Lives: %d",lives];
- (void)countDown
{
if (playing) {
timeLeft --;
if (timeLeft == 0) {
[self endGame];
}
}
[self updateLabels];
}
@jasonmcdermott
jasonmcdermott / showButton
Last active August 29, 2015 14:03
showButton & makeRect
- (void)showButton {
if (playing) {
int buttonSelection = arc4random() % 3;
if (buttonSelection == 1) {
self.hitMeButton.frame = [self makeFrameForButton:self.hitMeButton];
self.hitMeButton.hidden = FALSE;
} else if (buttonSelection == 0) {
//
// CCHelper.m
// jason-wednesday
//
// Created by codeCamp on 9/07/2014.
// Copyright (c) 2014 codeCamp. All rights reserved.
//
#import "CCHelper.h"
//
// CCHelper.h
// jason-wednesday
//
// Created by codeCamp on 9/07/2014.
// Copyright (c) 2014 codeCamp. All rights reserved.
//
#import <Foundation/Foundation.h>
- (PdAudioStatus)configurePlaybackWithSampleRate:(int)sampleRate
numberChannels:(int)numChannels
inputEnabled:(BOOL)inputEnabled
mixingEnabled:(BOOL)mixingEnabled
ambientEnabled:(BOOL)ambientEnabled {
PdAudioStatus status = PdAudioOK;
if (inputEnabled && ![[AVAudioSession sharedInstance] inputIsAvailable]) {
inputEnabled = NO;
status |= PdAudioPropertyChanged;
// assumes object class called SENQuestionnaire
- (void)writeDictionaryToDisk:(SENQuestionnaire *)q
{
NSDictionary *dataDictionary =
@{
@"stringA" : @"string A",
@"stringB" : @"string B",
@"stringC" : @"string C",
// Note this snippet requires AFNetworking v2.x
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.securityPolicy.allowInvalidCertificates = YES;
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSMutableDictionary *result = [[NSMutableDictionary alloc] init];
result[@"username"] = @"JohnSmith";
result[@"email"] = @"john@msith.com";
result[@"phone"] = @"06543213131";
result[@"name"] = @"John Smith";