Game Development Reference
In-Depth Information
#import "SneakyButton.h"
#import "SneakyButtonSkinnedBase.h"
#import "SneakyJoystick.h"
#import "SneakyJoystickSkinnedBase.h"
@interface InputLayer : CCLayer
{
SneakyButton* fireButton;
SneakyJoystick* joystick;
ccTime totalTime;
ccTime nextShotTime;
}
@end
In addition, you want to add a SneakyButton member variable for easier access to
the button you're going to create now. The addFireButton method does this in
Listing 7-9 . I explain the totalTime and nextShotTime variables as well as the
SneakyJoystick later.
Listing 7-9. Creating a SneakyButton
-(id) init
{
if ((self = [super init]))
{
[self addFireButton];
[self scheduleUpdate];
}
return self;
}
-(void) addFireButton
{
float buttonRadius = 80;
CGSize screenSize = [CCDirector sharedDirector].winSize;
fireButton = [[SneakyButton alloc] initWithRect:CGRectZero];
 
 
Search Nedrilad ::




Custom Search