Frank Di Natale And David Parker

3y ago
45 Views
4 Downloads
1.31 MB
51 Pages
Last View : 3m ago
Last Download : 3m ago
Upload by : Maleah Dent
Transcription

Frank Di Natale and David Parker

Contents Student BiosWhat is it?HistoryWhy use Cocos2d?FeaturesInstallationCreating a newproject Classes Descriptions ofvarious classes OO Principles withCocos2d The Big Picture OO Suggestions forCocos2d Number of games Other ports Future Other frameworks Resources

Frank Di Natale andDavid ParkerFrank is a PhD student inComputer Science ('16).He enjoys gaming, coding,and drawing. and being agangster.He wants to get his PhD inComputer Architecture andwork for Intel.Parker is a dual MS inComputer Science and MBAstudent ('13)He enjoys coding, running,bboying, sleeping, eating,and Scotch.He wants to solve theworld's problems oneprogram at a time.

What is it? Cocos2d is a framework for building 2dimensional (2D) applications (mostlygames) for iOS It is most commonly used for gamedevelopment It provides a wrapper to OpenGL ES whichis already on the iOS device

History Based on Cocos2d, written in Python Started march 2008 Originally named Los Cocos Cocos2d-iPhone Quickly became Cocos2d as the iOS versionovercame the Python version iPhone version started in April 2008 iPhone v0.1 released in July 2008 By end of 2008, over 40 games in the AppStore made with Cocos2d

Why use Cocos2d? Easy to Use Familiar, simple API and many examples Fast Uses OpenGL ES best practices Flexible Easy to use, easy to integrate with 3rd party libs Free OSS, closed and open source compatible Community support Big, active, friendly community (Forum and IRC) App Store approved 2500 App Store approved games use it

Features (I) Scene Management (workflow)Transitions between scenesSprite and Sprite sheetsEffects: Lens, ripple, liquid, etcActions (behaviors): Transformations: Move, Rotate, Scale Composable: Sequence, Repeat Ease: Exp, Sin Menus and Buttons Integrated physics engines (Box2d andChipmunk)

Features (II) Particle SystemText RenderingTexture Atlas SupportTile Map Support Orthogonal, Isometric, Hexagonal Parallax Scrolling SupportSound SupportStreak Motion SupportRender Texture SupportMany, many more.

InstallationDownload the latest (stable) version at:http://www.cocos2d-iphone.org/downloadInstall the templates by running:./install-templates.sh -u -f

Creating a New ProjectOpen Xcode New Project cocos2d

Classes (I) anagerCCActionPageTurn3d CCActionProgressTimer CCActionTiledGrid CCActionTween CCAnimation CCAnimationCache CCAtlasNode CCBlockSupport CCCamera CCConfiguration

Classes (II) CCDirector CCDrawingPrimitives CCGrabber CCGrid CCLabelAtlas CCLabelBMFont CCLabelTTF CCLayer CCMenu icleSystemCCParticleSystemPoint CCParticleSystemQuad CCProgressTimer

Classes (III) CSpriteBatchNode CCSpriteFrame CCSpriteFrameCache RCCTileMapAtlasCCTMXLayerCCTMXObjectGroup CCTMXTiledMap CCTMXXMLParser

Classes (IV) CCTransition CCTransitionPageTurn CCTransitionRadialDue to the high number of classes used, thispresentation will only cover "key" classesused to make a game with Cocos2d.

Class: CCNodeSource Code: elop/cocos2d/CCNode.mDocumentation: ace c c node.html CCNode is the base element in Cocos2D. Anything that can be drawn uses the CCNode object. CCNode Features: They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc)They can schedule periodic callback (schedule, unschedule,etc)They can execute actions (runAction, stopAction, etc)They can be translated, scaled, rotated, skewed, and moved.

Class: CCNodeHow it uses OO? Some CCNode nodesprovide extra functionality forthem or their children.The most popular CCNodesare: CCScene, CCLayer,CCSprite, CCMenu.Subclassing a CCNodeusually means (one/all) of: overriding init toinitialize resources andschedule callbacks create callbacks tohandle theadvancement of time overriding draw torender the node

Class: CCSpriteSource Code: elop/cocos2d/CCSprite.mDocumentation: ace c c sprite.htmlCCSprites are derived from the CCNodeclass and have the same features. CCSprite is used to denote a CCNode thathas an image that can be displayed to theuser. Supports blending functions Supports aliasing/anti-aliasing

Class: CCSprite Example of sprites from Nintendo'sPokemon Black on the Nintendo DS

Class: CCSpriteHow it uses OO? A CCSprite is used tomanage an image to berendered to the outputscreen. Use of the CCSprite allowsfor batch rendering using theCCSpriteBatchNode. Each CCSprite requires asingle OpenGL call to berendered. Using batch rendering reducesthe number of OpenGL callsmade to render objects to thescreen.

Class: CCLayerSource Code: elop/cocos2d/CCLayer.mDocumentation: face c c layer.html CCLayer is a subclass of CCNode that implements the TouchEventsDelegate protocol.All features from CCNode are valid, plus the followingnew features: It can receive iPhone Touches. It can receive Accelerometer input

Class: CCLayerHow it uses OO? A CCLayer is no different than a CCNode, with the only exceptionbeing its implementation of touched interfaces. The use of interfacing allows for developers to modify how their own gamelayers respond to touch (or disable it altogether).

Class: CCSceneSource Code: elop/cocos2d/CCScene.mDocumentation: ace c c scene.html CCScene is a subclass of CCNode that isused only as an abstract concept. CCScene an CCNode are almost identical with the difference thatCCScene has it's anchor point (by default) at the center of the screen. For the moment CCScene has no other logic than that, but in futurereleases it might have additional logic. It is a good practice to use and CCScene as the parent of all yournodes.

Class: CCSceneHow it uses OO? While the CCScene object is basically anode, there is the notion of a scene stackthat controls the ordering of scenes. The basic operation consists of a scene replacing the current scene,which does not require the use of the stack. The scene stack,however, is useful for layering multiple scenes on top of otherbackground scenes.The stack is useful for scenes where it is possible to have a menuappear over the current game screen (such as pause menus,inventory screens, etc.)Another use is overlaying cutscenes onto the game screen, whichwould allow the player to resume where they left off one the scene ispopped.

Class: CCDirectorSource Code: elop/cocos2d/CCDirector.mDocumentation: ace c c director.htmlCCDirector creates and handles the mainWindow and manages how and when toexecute scenes.The CCDirector is also responsible for: Initializing the OpenGL ES contextSetting OpenGL pixel format (default is RGB565)Setting OpenGL buffer depth (default is 0-bit)Setting projection (default one is 3D)Setting orientation (default one is Portrait)

Class: CCDirectorSingleton GoodnessCCDirector uses the Singleton Design Pattern.The Singleton DP is used throughout Cocos2d.The CCDirector instance is created within theAppDelegate.Since the CCDirector is a singleton, thestandard way to use it is by calling:[[CCDirector sharedDirector] methodName];

Class: CCDirectorUsageThe main two things the CCDirector ends upbeing used for is screen size and scenemanagement:For scene management, the methods regularlyused are: runWithScene, replaceScene,pushScene, and popScene.

Class: CCActionSource Code: elop/cocos2d/CCAction.mDocumentation: ace c c action.htmlBase class for all Action classes Keeps track of target of action Action will affect the target based on appropriate tagAction subclasses are generally in one of twocategories: Instant actions - no duration Interval actions - takes place within period of time

Class: CCActionInstant Actions (lesscommon): Flipping Hiding Showing Placing Toggling VisibilityInterval Actions(more common): Easing Fading Moving Rotation Scaling Tinting Many more

Class: CCActionThat's one HUGE Inheritance Tree:

Class: CCActionHuge Inheritance Tree (a little closer):

Class: CCActionUsageCreate the specific type of action you want:In this example, we're creating a Tint action.We can create multiple, then add them to a Sequence,which we can then Repeat if we want. In this example, weattach the RepeatForever Action to the menu:This will end performing a tint on the playButton, which willtint between red, green, and blue indefinitely.

Class: CCMenuSource Code: elop/cocos2d/CCMenu.mDocumentation: ace c c menu.htmlAllows easy addition of a menu to gameFeatures and Limitation: You can add MenuItem objects in runtime using addChild:But the only accepted children are MenuItem objects

Class: CCMenuItemSource Code: elop/cocos2d/CCMenuItem.mDocumentation: ace c c menu item.htmlSuper class for creating Menu Items

Class: CCMenu &CCMenuItem UsageCreate a menu item that you want to use.Then create a menu withthat menu item, or attachit after creation.Now the button is added:

OO Principles withCocos2d It is possible with the basic classes mentioned previously to create a set of generic objects that areused to create the main gameplay mechanics.GameObject The base representation of all objects within the game. Aggregates a few objects: CCAnimation (subclass of CCAction) for animations CCSprite to set its rendering image HealthBehavior for tracking object life points (custom object) Movement behavior and methods

OO Principles withCocos2d GameCharacter Derived from the GameObject class because a GameCharacter IS-AGameObjectUsed to create in-game NPCs Overloads movement, animations, and other methods as needed.You can additionally derive from GameCharacter tomake a PlayerCharacter.Other objects that can be made from the existingCocos2d libraries include specialized scenes (mainmenu scene, inventory scene, etc.)

OO Principles withCocos2d - GameObject The GameObject simplyaggregates a CCSprite andother property classes such asCCAction, CCAnimation, etc. Favoring aggregation over inheritance helps to keep the number of objectsmanageable because GameObjectsexhibit varying behavior.This design also allows new behaviorsto be developed without affecting otherclasses, promoting loose coupling.

OO Principles withCocos2d - GameObject From the GameObject, the GameCharacter class is asimple derivation with the following: Overrides for default movement behavior. Assuming the GameObject would assume stationary objects, the new behavior would providemovement.Health behavior could continue to be varied based on the type ofGameCharacter (NPC, enemy, etc.)The GameCharacter object would be the base object that NPCs,enemies, the player would inherit from.

The Big Picture The CCDirector is the controller to all of the otherscenes in the game, coordinating timing andappearance. The Gameplay Scenehas been expandedto show how a sceneis broken down intolayers by function.Each layer is thenconstructed of thenecessary sprites andmethods.

OO Suggestions forCocos2d?Cocos2d suffers greatly from using inheritanceover using composition. For example, see the CCAction inheritancetree above. As opposed to having an CCActionBehavior,which can be assigned and set on the fly,the framework uses inheritance. Instead, it should be using the Strategy pattern toallow different behaviors to be set.Otherwise, Cocos2d is pretty well designed.

Number of gamesusing Cocos2d4,289 games listed on http://www.cocos2diphone.org/games/as of October 17, 2012.Probably hundreds (or thousands) more notlisted!

Other portsBesides Cocos2d, there are several otherports: Cocos2d-x C Implementation of Cocos2d Cocos2d-html5 JavaScript port Targets the Cocos2d-x API Cocos2d-android Java port for Android

Future (I)In active one 2,340 users "starred" Cocos2d 521 forks 1000 commitsLast commit (as of Nov 10): v1.X - Oct 21st v2.X - Nov 9th

Future (II)Current stable build: v1.1.0Next version build: v2.1-beta3 released November 7, 2012 Allows targeting JavaScript (Cocos2d-x API) Atwood's Law: "Any application that can be written in JavaScript,will eventually be written in JavaScript."

Other Frameworks Cocos2d-x http://www.cocos2d-x.org/ Corona http://www.coronalabs.com/products/corona-sdk/ Unity http://unity3d.com/ Sparrow http://gamua.com/sparrow/ OpenGL ES (the metal) http://www.khronos.org/opengles/

Resources (I)Framework and documentation: http://www.cocos2d-iphone.org/ http://www.cocos2d-iphone.org/wiki/doku.php/ ipedia: http://en.wikipedia.org/wiki/Cocos2d

Resources (II)Issues tracker: Source code: https://github.com/cocos2d/cocos2d-iphone/

Resources (III)List of games using: http://www.cocos2d-iphone.org/games/Very active forum: http://www.cocos2d-iphone.org/forum/

Resources (IV)History: http://www.cocos2d-ipho

David Parker Parker is a dual MS in Computer Science and MBA student ('13) He enjoys coding, running, bboying, sleeping, eating, and Scotch. He wants to solve the world's problems one program at a time. Frank is a PhD student in Computer Science ('16).

Related Documents:

Bellamy Young Ben Feldman Ben McKenzie Ben Stiller Ben Whishaw Beth Grant Bethany Mota Betty White Bill Nighy Bill Pullman Billie Joe Armstrong Bingbing Li Blair Underwood . David Koechner David Kross David Letterman David Lyons David Mamet David Mazouz David Morrissey David Morse David Oyelowo David Schwimmer David Suchet David Tennant David .

Novena di Natale per le famiglie Da Lunedì 16 a Lunedì 23 dicembre ore 20.30 - 20.55 Domenica 22 dicembre cambio orario, durante la S. Messa delle ore 10 a Lenno “P reoccupazione in Cielo, pace in terra ”: la novena di Natale ci immerge nel clima di attesa per la nascita di Gesù, l’Emmanuele-Dio con noi.

Titolo Il figlio di Babbo Natale Titolo originale Arthur Christmas Paese, Anno Gran Bretagna Stati Uniti, 2011 Regia Sara Smith ; Barry Cook Film per tutti Trama Babbo Natale consegna ogn i hanno centinaia di milioni di regali, grazie al suo esercito di elfi e alla sua slitta supersonica. Nonostante questo, a poche ore dall'alba Babbo Natale e il figlio

Antonio VIVALDI (1678-1741) Violin oncerto in E, ZIl riposo [ Zper il Santisssimo Natale, RV270 [7:28] Francesco MANFREDINI (1684-1762) Concerto Grosso in , Op.3/12 ZPer il Santissimo Natale [ [7:55] Pietro LOCATELLI (1695-1764) oncerto Grosso in f minor, Op.1/8 ZPer il Santo Natale [13:14]

Anne Frank (1992) Le monde de Anne Frank (1990) Anne Frank, les sept derniers mois (1989) Journal (1986) Anne Frank in the world, 1929-1945 (1985) Anne Frank (1983) Vérité historique ou vérité politique ? (1980) Documents multimédia (3) Mallette Anne Frank (2010) Le journal d'Anne Franck (2000)

Roto Frank AG Window and door technology Wilhelm-Frank-Platz 1 70771 Leinfelden-Echterdingen Germany Phone 49 711 7598 0 Fax 49 711 7598 253 info@roto-frank.com www.roto-frank.com Roto Frank AG Window and door technology Eintrachtstraße 95 42551 Velbert Germany Phone 49 2051 203 0

Quattro menù completi per tutte le età e tutte le tasche www.buttalapasta.it Ricette di Natale

Artificial Intelligence (AI) is an important and well established area of modern computer science that can often provide a means of tackling computationally large or complex problems in a realistic time-frame. Digital forensics is an area that is becoming increasingly important in computing and often requires the intelligent analysis of large amounts of complex data. It would therefore seem .