Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 05b6580e7a
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (45 sloc) 1.556 kB
// PaddlesLayer.m
// PeerPong
// Created by Volker Tietz on 11/18/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
#import "PaddlesLayer.h"
#import "PeerPongGameplay.h"
#import "PeerPongPlayer.h"
#import "PeerPongPaddle.h"
@implementation PaddlesLayer
-(id) init {
self = [super init];
if (self) {
gameplay = [PeerPongGameplay sharedInstance];
return self;
-(void)addPaddleForPlayer:(PeerPongPlayer *)aPlayer {
aPlayer.paddle = [[[PeerPongPaddle alloc] initWithPlayer:aPlayer] autorelease];
[aPlayer.paddle addPhysics];
[aPlayer.paddle.sprite addChild:aPlayer.paddle.playerName z:5];
[aPlayer.paddle.sprite addChild:aPlayer.paddle.playerNameShadow z:4];
[aPlayer.paddle.sprite addChild:aPlayer.paddle.playerLivesLeft];
[self addChild:aPlayer.paddle.sprite];
[aPlayer.paddle.sprite runAction:[CCFadeIn actionWithDuration:0.5]];
-(void)removePaddleForPlayer:(PeerPongPlayer *)aPlayer {
[aPlayer.paddle removePhysics];
[aPlayer.paddle.sprite removeChild:aPlayer.paddle.playerNameShadow cleanup:YES];
[aPlayer.paddle.sprite removeChild:aPlayer.paddle.playerName cleanup:YES];
[aPlayer.paddle.sprite removeChild:aPlayer.paddle.playerLivesLeft cleanup:YES];
[self removeChild:aPlayer.paddle.sprite cleanup:YES];
-(void)updatePaddles {
for (PeerPongPlayer *player in [gameplay.players allValues]) {
[player.paddle update];
#pragma mark - Dealloc
-(void) dealloc {
[super dealloc];
Jump to Line
Something went wrong with that request. Please try again.