资源简介
高仿超级马里奥,求下载!
代码片段和文件信息
//
// button.m
// Classroom Demo
//
// Created by Nick Pannuto on 2/10/10.
// Copyright 2010 Sneakyness llc.. All rights reserved.
//
#import “SneakyButton.h“
@implementation SneakyButton
@synthesize status value active isHoldable isToggleable rateLimit radius;
-(void) onEnterTransitionDidFinish
{
#ifdef __CC_PLATFORM_IOS
CCLOG(@“iOS SneakyInput“);
CCDirector *director = (CCDirector*)[CCDirector sharedDirector];
[[director touchDispatcher] removeDelegate:self];
[[director touchDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:YES];
#elif defined (__CC_PLATFORM_MAC)
CCLOG(@“Mac SneakyInput“);
[[[CCDirector sharedDirector] eventDispatcher] removeMouseDelegate:self];
[[[CCDirector sharedDirector] eventDispatcher] addMouseDelegate:self priority:1];
#endif
//CMLog(@“...%s...“ __PRETTY_FUNCTION__);
[super onEnterTransitionDidFinish];
}
- (void)onExit
{
#ifdef __CC_PLATFORM_IOS
CCDirector *director = (CCDirector*)[CCDirector sharedDirector];
[[director touchDispatcher] removeDelegate:self];
#elif defined (__CC_PLATFORM_MAC)
[[[CCDirector sharedDirector] eventDispatcher] removeMouseDelegate:self];
#endif
[super onExit];
}
-(id)initWithRect:(CGRect)rect{
self = [super init];
if(self){
bounds = CGRectMake(0 0 rect.size.width rect.size.height);
center = CGPointMake(rect.size.width/2 rect.size.height/2);
status = 1; //defaults to enabled
active = NO;
value = 0;
isHoldable = 0;
isToggleable = 0;
radius = 32.0f;
rateLimit = 1.0f/120.0f;
position_ = rect.origin;
}
return self;
}
-(void)limiter:(float)delta{
value = 0;
[self unschedule: @selector(limiter:)];
active = NO;
}
- (void) setRadius:(float)r
{
radius = r;
radiusSq = r*r;
}
#pragma mark Touch Delegate
#ifdef __CC_PLATFORM_IOS
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if (active) return NO;
CGPoint location = [[CCDirector sharedDirector] convertToGL:[touch locationInView:[touch view]]];
location = [self convertToNodeSpace:location];
//Do a fast rect check before doing a circle hit check:
if(location.x < -radius || location.x > radius || location.y < -radius || location.y > radius){
return NO;
}else{
float dSq = location.x*location.x + location.y*location.y;
if(radiusSq > dSq){
active = YES;
if (!isHoldable && !isToggleable){
value = 1;
[self schedule: @selector(limiter:) interval:rateLimit];
}
if (isHoldable) value = 1;
if (isToggleable) value = !value;
return YES;
}
}
return NO;
}
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
if (!active) return;
CGPoint location = [[CCDirector sharedDirector] convertToGL:[touch locationInView:[touch view]]];
location = [self convertToNodeSpace:location];
//Do a fast rect check before doing a circle hit check:
if(location.x < -radius || location.x > radius || location.y < -radius || location.y > radius){
return;
}else{
float dSq = location.x
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-08-26 15:30 Model.xcdatamodeld\
文件 258 2017-07-05 07:02 Model.xcdatamodeld\.xccurrentversion
目录 0 2020-08-26 15:30 Model.xcdatamodeld\Model.xcdatamodel\
文件 581 2017-07-05 07:02 Model.xcdatamodeld\Model.xcdatamodel\contents
文件 991 2017-07-05 07:02 SneakyButton.h
文件 5173 2017-07-05 07:02 SneakyButton.m
文件 656 2017-07-05 07:02 SneakyButtonSkinnedba
文件 2712 2017-07-05 07:02 SneakyButtonSkinnedba
文件 1806 2017-07-05 07:02 SneakyJoystick.h
文件 6241 2017-07-05 07:02 SneakyJoystick.m
文件 536 2017-07-05 07:02 SneakyJoystickSkinnedba
文件 1830 2017-07-05 07:02 SneakyJoystickSkinnedba
目录 0 2020-08-26 15:30 SuperMario\
文件 2633 2017-07-05 07:02 SuperMario\AppDelegate.h
文件 10858 2017-07-05 07:02 SuperMario\AppDelegate.mm
文件 4031 2017-07-05 07:02 SuperMario\DownWorldla
文件 112859 2017-07-05 07:02 SuperMario\DownWorldla
文件 2279 2017-07-05 07:02 SuperMario\GLES-Render.h
文件 7291 2017-07-05 07:02 SuperMario\GLES-Render.mm
文件 2576 2017-07-05 07:02 SuperMario\GameConfig.h
文件 553 2017-07-05 07:02 SuperMario\GameInfola
文件 6795 2017-07-05 07:02 SuperMario\GameInfola
文件 1191 2017-07-05 07:02 SuperMario\Gameob
文件 3166 2017-07-05 07:02 SuperMario\Gameob
文件 1508 2017-07-05 07:02 SuperMario\HudStickla
文件 12499 2017-07-05 07:02 SuperMario\HudStickla
文件 396 2017-07-05 07:02 SuperMario\Introla
文件 2607 2017-07-05 07:02 SuperMario\Introla
文件 379 2017-07-05 07:02 SuperMario\Level.h
文件 4660 2017-07-05 07:02 SuperMario\Level.mm
文件 4359 2017-07-05 07:02 SuperMario\MainGamela
............此处省略413个文件信息
- 上一篇:ntpclient的实现源代码
- 下一篇:基于等高线的三维地形建模
相关资源
- cocos2d-x飞机大战项目
- Cocos2d-x开发游戏的坐标系知识介绍
- Cocos2d-x 3.x 头像选择器功能扩展Image
- 节奏大师源码
- 炸弹人(cocos2d-x 3.2)
- Cocos Creator 实现的超级玛丽小游戏de
- cocos2dx经典三消游戏
- cocos2dx-3.0正式版源代码+完整资源 微信
- Cocos2d-x 瓦片地图操作Demo-双指缩放、
- xxtea加解密工具win32
- Cocos2D游戏之旅六:流星、烟花、火焰
- Cocos2dx游戏源代码《萝莉快跑》
- cocos2d-x游戏源码
- 公司年会抽奖程序
- cocos2d-x 别踩白块源码
- Cocos2dx入门初级教程
- cocos2dx 3.3 跑酷游戏源代码和资源
- 超级马里奥 小游戏源码
- 捕鱼达人.zip
- 萝莉快跑2013
- cocos creator 开心消消乐
- 三国跑酷cocos2dx3.2源码
- Cocos2d-x《大抗战》塔防射击游戏源代
- richer单机完毕源码
- 连连看 cocos2dx 源代码
- 基于cocos开发的飞机大战含素材资源
- cocos2dx 大鱼吃小鱼游戏源代码
- FC超级马里奥全套素材
- 迷失航线-Cocos2d-x项目实战-射击类游戏
- cocos2dx 3.x 水波纹
评论
共有 条评论