实例介绍
在这篇文章,将会学习到如何制作一个塔防游戏。在这当中,学习如何在设定的时间内出现一波波的敌人,使这些敌人沿着指定的路点前进,如何在地图上指定的位置创建炮塔,如何使炮塔射击敌人,如何可视化调试路点和炮塔的攻击范围。
【实例截图】
【核心代码】
53e81daf-c878-4a8a-9ebf-f16d8262aadc
└── TowerDefenseUpdate-StarterProject
├── Readme
├── TowerDefenseUpdate
│ ├── 8bitDungeonLevel.mp3
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── bg-hd.png
│ ├── bg.png
│ ├── bullet-hd.png
│ ├── bullet.png
│ ├── enemy_destroy_2.wav
│ ├── enemy_destroy.wav
│ ├── enemy-hd.png
│ ├── enemy.png
│ ├── font_red_14.fnt
│ ├── font_red_14.png
│ ├── font_red_28.png
│ ├── font_red-hd.fnt
│ ├── HelloWorldLayer.h
│ ├── HelloWorldLayer.m
│ ├── icon_gold-hd.png
│ ├── icon_gold.png
│ ├── icon_HP-hd.png
│ ├── icon_HP.png
│ ├── IntroLayer.h
│ ├── IntroLayer.m
│ ├── laser_shoot.wav
│ ├── libs
│ │ ├── cocos2d
│ │ │ ├── CCActionCamera.h
│ │ │ ├── CCActionCamera.m
│ │ │ ├── CCActionCatmullRom.h
│ │ │ ├── CCActionCatmullRom.m
│ │ │ ├── CCActionEase.h
│ │ │ ├── CCActionEase.m
│ │ │ ├── CCActionGrid3D.h
│ │ │ ├── CCActionGrid3D.m
│ │ │ ├── CCActionGrid.h
│ │ │ ├── CCActionGrid.m
│ │ │ ├── CCAction.h
│ │ │ ├── CCActionInstant.h
│ │ │ ├── CCActionInstant.m
│ │ │ ├── CCActionInterval.h
│ │ │ ├── CCActionInterval.m
│ │ │ ├── CCAction.m
│ │ │ ├── CCActionManager.h
│ │ │ ├── CCActionManager.m
│ │ │ ├── CCActionPageTurn3D.h
│ │ │ ├── CCActionPageTurn3D.m
│ │ │ ├── CCActionProgressTimer.h
│ │ │ ├── CCActionProgressTimer.m
│ │ │ ├── CCActionTiledGrid.h
│ │ │ ├── CCActionTiledGrid.m
│ │ │ ├── CCActionTween.h
│ │ │ ├── CCActionTween.m
│ │ │ ├── CCAnimationCache.h
│ │ │ ├── CCAnimationCache.m
│ │ │ ├── CCAnimation.h
│ │ │ ├── CCAnimation.m
│ │ │ ├── CCAtlasNode.h
│ │ │ ├── CCAtlasNode.m
│ │ │ ├── CCCamera.h
│ │ │ ├── CCCamera.m
│ │ │ ├── CCClippingNode.h
│ │ │ ├── CCClippingNode.m
│ │ │ ├── ccConfig.h
│ │ │ ├── CCConfiguration.h
│ │ │ ├── CCConfiguration.m
│ │ │ ├── ccDeprecated.h
│ │ │ ├── ccDeprecated.m
│ │ │ ├── CCDirector.h
│ │ │ ├── CCDirector.m
│ │ │ ├── CCDrawingPrimitives.h
│ │ │ ├── CCDrawingPrimitives.m
│ │ │ ├── CCDrawNode.h
│ │ │ ├── CCDrawNode.m
│ │ │ ├── ccFPSImages.h
│ │ │ ├── ccFPSImages.m
│ │ │ ├── CCGLProgram.h
│ │ │ ├── CCGLProgram.m
│ │ │ ├── ccGLStateCache.h
│ │ │ ├── ccGLStateCache.m
│ │ │ ├── CCGrabber.h
│ │ │ ├── CCGrabber.m
│ │ │ ├── CCGrid.h
│ │ │ ├── CCGrid.m
│ │ │ ├── CCLabelAtlas.h
│ │ │ ├── CCLabelAtlas.m
│ │ │ ├── CCLabelBMFont.h
│ │ │ ├── CCLabelBMFont.m
│ │ │ ├── CCLabelTTF.h
│ │ │ ├── CCLabelTTF.m
│ │ │ ├── CCLayer.h
│ │ │ ├── CCLayer.m
│ │ │ ├── ccMacros.h
│ │ │ ├── CCMenu.h
│ │ │ ├── CCMenuItem.h
│ │ │ ├── CCMenuItem.m
│ │ │ ├── CCMenu.m
│ │ │ ├── CCMotionStreak.h
│ │ │ ├── CCMotionStreak.m
│ │ │ ├── CCNode+Debug.h
│ │ │ ├── CCNode+Debug.m
│ │ │ ├── CCNode.h
│ │ │ ├── CCNode.m
│ │ │ ├── CCParallaxNode.h
│ │ │ ├── CCParallaxNode.m
│ │ │ ├── CCParticleBatchNode.h
│ │ │ ├── CCParticleBatchNode.m
│ │ │ ├── CCParticleExamples.h
│ │ │ ├── CCParticleExamples.m
│ │ │ ├── CCParticleSystem.h
│ │ │ ├── CCParticleSystem.m
│ │ │ ├── CCParticleSystemQuad.h
│ │ │ ├── CCParticleSystemQuad.m
│ │ │ ├── CCPhysicsDebugNode.h
│ │ │ ├── CCPhysicsDebugNode.m
│ │ │ ├── CCPhysicsSprite.h
│ │ │ ├── CCPhysicsSprite.mm
│ │ │ ├── CCProgressTimer.h
│ │ │ ├── CCProgressTimer.m
│ │ │ ├── CCProtocols.h
│ │ │ ├── CCRenderTexture.h
│ │ │ ├── CCRenderTexture.m
│ │ │ ├── CCScene.h
│ │ │ ├── CCScene.m
│ │ │ ├── CCScheduler.h
│ │ │ ├── CCScheduler.m
│ │ │ ├── CCShaderCache.h
│ │ │ ├── CCShaderCache.m
│ │ │ ├── ccShader_PositionColor_frag.h
│ │ │ ├── ccShader_PositionColorLengthTexture_frag.h
│ │ │ ├── ccShader_PositionColorLengthTexture_vert.h
│ │ │ ├── ccShader_PositionColor_vert.h
│ │ │ ├── ccShader_PositionTextureA8Color_frag.h
│ │ │ ├── ccShader_PositionTextureA8Color_vert.h
│ │ │ ├── ccShader_PositionTextureColorAlphaTest_frag.h
│ │ │ ├── ccShader_PositionTextureColor_frag.h
│ │ │ ├── ccShader_PositionTextureColor_vert.h
│ │ │ ├── ccShader_PositionTexture_frag.h
│ │ │ ├── ccShader_PositionTexture_uColor_frag.h
│ │ │ ├── ccShader_PositionTexture_uColor_vert.h
│ │ │ ├── ccShader_PositionTexture_vert.h
│ │ │ ├── ccShader_Position_uColor_frag.h
│ │ │ ├── ccShader_Position_uColor_vert.h
│ │ │ ├── ccShaders.h
│ │ │ ├── ccShaders.m
│ │ │ ├── CCSpriteBatchNode.h
│ │ │ ├── CCSpriteBatchNode.m
│ │ │ ├── CCSpriteFrameCache.h
│ │ │ ├── CCSpriteFrameCache.m
│ │ │ ├── CCSpriteFrame.h
│ │ │ ├── CCSpriteFrame.m
│ │ │ ├── CCSprite.h
│ │ │ ├── CCSprite.m
│ │ │ ├── CCTexture2D.h
│ │ │ ├── CCTexture2D.m
│ │ │ ├── CCTextureAtlas.h
│ │ │ ├── CCTextureAtlas.m
│ │ │ ├── CCTextureCache.h
│ │ │ ├── CCTextureCache.m
│ │ │ ├── CCTexturePVR.h
│ │ │ ├── CCTexturePVR.m
│ │ │ ├── CCTileMapAtlas.h
│ │ │ ├── CCTileMapAtlas.m
│ │ │ ├── CCTMXLayer.h
│ │ │ ├── CCTMXLayer.m
│ │ │ ├── CCTMXObjectGroup.h
│ │ │ ├── CCTMXObjectGroup.m
│ │ │ ├── CCTMXTiledMap.h
│ │ │ ├── CCTMXTiledMap.m
│ │ │ ├── CCTMXXMLParser.h
│ │ │ ├── CCTMXXMLParser.m
│ │ │ ├── CCTransition.h
│ │ │ ├── CCTransition.m
│ │ │ ├── CCTransitionPageTurn.h
│ │ │ ├── CCTransitionPageTurn.m
│ │ │ ├── CCTransitionProgress.h
│ │ │ ├── CCTransitionProgress.m
│ │ │ ├── ccTypes.h
│ │ │ ├── cocos2d.h
│ │ │ ├── cocos2d.m
│ │ │ ├── Platforms
│ │ │ │ ├── CCGL.h
│ │ │ │ ├── CCNS.h
│ │ │ │ ├── iOS
│ │ │ │ │ ├── CCDirectorIOS.h
│ │ │ │ │ ├── CCDirectorIOS.m
│ │ │ │ │ ├── CCES2Renderer.h
│ │ │ │ │ ├── CCES2Renderer.m
│ │ │ │ │ ├── CCESRenderer.h
│ │ │ │ │ ├── CCGLView.h
│ │ │ │ │ ├── CCGLView.m
│ │ │ │ │ ├── CCTouchDelegateProtocol.h
│ │ │ │ │ ├── CCTouchDispatcher.h
│ │ │ │ │ ├── CCTouchDispatcher.m
│ │ │ │ │ ├── CCTouchHandler.h
│ │ │ │ │ └── CCTouchHandler.m
│ │ │ │ └── Mac
│ │ │ │ ├── CCDirectorMac.h
│ │ │ │ ├── CCDirectorMac.m
│ │ │ │ ├── CCEventDispatcher.h
│ │ │ │ ├── CCEventDispatcher.m
│ │ │ │ ├── CCGLView.h
│ │ │ │ ├── CCGLView.m
│ │ │ │ ├── CCWindow.h
│ │ │ │ └── CCWindow.m
│ │ │ └── Support
│ │ │ ├── base64.c
│ │ │ ├── base64.h
│ │ │ ├── CCArray.h
│ │ │ ├── CCArray.m
│ │ │ ├── ccCArray.h
│ │ │ ├── ccCArray.m
│ │ │ ├── CCFileUtils.h
│ │ │ ├── CCFileUtils.m
│ │ │ ├── CCProfiling.h
│ │ │ ├── CCProfiling.m
│ │ │ ├── ccUtils.c
│ │ │ ├── ccUtils.h
│ │ │ ├── CCVertex.h
│ │ │ ├── CCVertex.m
│ │ │ ├── CGPointExtension.h
│ │ │ ├── CGPointExtension.m
│ │ │ ├── NSThread+performBlock.h
│ │ │ ├── NSThread+performBlock.m
│ │ │ ├── OpenGL_Internal.h
│ │ │ ├── TGAlib.h
│ │ │ ├── TGAlib.m
│ │ │ ├── TransformUtils.h
│ │ │ ├── TransformUtils.m
│ │ │ ├── uthash.h
│ │ │ ├── utlist.h
│ │ │ ├── ZipUtils.h
│ │ │ └── ZipUtils.m
│ │ ├── CocosDenshion
│ │ │ ├── CDAudioManager.h
│ │ │ ├── CDAudioManager.m
│ │ │ ├── CDConfig.h
│ │ │ ├── CDOpenALSupport.h
│ │ │ ├── CDOpenALSupport.m
│ │ │ ├── CDXMacOSXSupport.h
│ │ │ ├── CDXMacOSXSupport.m
│ │ │ ├── CDXPropertyModifierAction.h
│ │ │ ├── CDXPropertyModifierAction.m
│ │ │ ├── CocosDenshion.h
│ │ │ ├── CocosDenshion.m
│ │ │ ├── README.md
│ │ │ ├── SimpleAudioEngine.h
│ │ │ └── SimpleAudioEngine.m
│ │ ├── kazmath
│ │ │ ├── include
│ │ │ │ └── kazmath
│ │ │ │ ├── aabb.h
│ │ │ │ ├── GL
│ │ │ │ │ ├── mat4stack.h
│ │ │ │ │ └── matrix.h
│ │ │ │ ├── kazmath.h
│ │ │ │ ├── mat3.h
│ │ │ │ ├── mat4.h
│ │ │ │ ├── neon_matrix_impl.h
│ │ │ │ ├── plane.h
│ │ │ │ ├── quaternion.h
│ │ │ │ ├── ray2.h
│ │ │ │ ├── utility.h
│ │ │ │ ├── vec2.h
│ │ │ │ ├── vec3.h
│ │ │ │ └── vec4.h
│ │ │ └── src
│ │ │ ├── aabb.c
│ │ │ ├── ChangeLog
│ │ │ ├── CMakeLists.txt
│ │ │ ├── GL
│ │ │ │ ├── mat4stack.c
│ │ │ │ └── matrix.c
│ │ │ ├── mat3.c
│ │ │ ├── mat4.c
│ │ │ ├── neon_matrix_impl.c
│ │ │ ├── plane.c
│ │ │ ├── quaternion.c
│ │ │ ├── ray2.c
│ │ │ ├── utility.c
│ │ │ ├── vec2.c
│ │ │ ├── vec3.c
│ │ │ └── vec4.c
│ │ ├── LICENSE_cocos2d.txt
│ │ ├── LICENSE_CocosDenshion.txt
│ │ └── LICENSE_Kazmath.txt
│ ├── life_lose.wav
│ ├── main.m
│ ├── open_spot-hd.png
│ ├── open_spot.png
│ ├── Prefix.pch
│ ├── Resources
│ │ ├── Default@2x.png
│ │ ├── Default-568h@2x.png
│ │ ├── Default-Landscape~ipad.png
│ │ ├── Default.png
│ │ ├── Icon@2x.png
│ │ ├── Icon-72.png
│ │ ├── Icon.png
│ │ ├── Icon-Small@2x.png
│ │ ├── Icon-Small-50.png
│ │ ├── Icon-Small.png
│ │ ├── Info.plist
│ │ └── iTunesArtwork
│ ├── tower-hd.png
│ ├── tower_place.wav
│ ├── tower.png
│ ├── TowersPosition.plist
│ └── Waves.plist
└── TowerDefenseUpdate.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
└── brian.xcuserdatad
└── xcschemes
├── TowerDefenseUpdate.xcscheme
└── xcschememanagement.plist
21 directories, 299 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论