I am making a game for my psychology lab that has different scenes (jungle, sea, desert, moon, dungeon ect.) but the character behavior for each scene is essentially the same. Is it possible to write a class that will have all of the essential behaviors and animations that every sprite will need and then have subclasses that inherit from this class (I would only want to change the sprites image based on the scene in each subclass).
Whats the best structure to use when you have many characters that all have the same behavior and animation but different Sprite images?
128 Views Asked by Daniela Carrasco At
1
There are 1 best solutions below
Related Questions in OBJECTIVE-C
- How do I customize NSOutlineView to have border color?
- UIWebView Screen Fitting Issue
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Image and Text locations in UIButton
- setting OpenGL version in objective-C
- Setup code for xibs in iOS. -awakFromNb:
- realm db, get parent link of object
- CFBundleDocumentType is not working in myproject-Info.plist file
- UIPopoverPresentationController not rendering properly
- Using Storyboard Reference
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Unexpected CALayer Vertical Flipping on 3D Rotation 'Bounce'
- Setting View orientation to portrait is ignored
- UITextField append / between dates while enforcing character limit
Related Questions in INHERITANCE
- Inheritance in Java, apparent type vs actual type
- Why does compiler recognize while(true) at compile time but not if(true)
- How to write tests for classes with inheritance
- How to make methods from parent class use a different variable?
- Why put methods on the prototype of a class instead of declaring them in the constructor?
- AbstractMethodError when mixing in trait nested in object - only when compiled and imported
- Inheritance and Polymorphism in C#
- WCF reusing types with inheritance - cannot generate client code
- Inherit jQuery-like pattern
- C++ inheritance, interfaces
- Visual C++ - Virtual method is not overriden
- Inheritance with base class constructor with parameters
- Access Parent Class without declaring property
- Class factory to create derived classes c++
- Child element not to inherit parent property (not style) in html
Related Questions in STRUCTURE
- Optimum directory structure for large number of files to display on a page
- Whats the best structure to use when you have many characters that all have the same behavior and animation but different Sprite images?
- All HTML5 structural elements?
- How to improve Project structure in c# web application
- Adding an event to an event structure
- What does the value `/W` mean in PDF `/Tabs` key?
- Access Struct in C++?
- How to extract business logic in this example
- Firebase data structure with cyclic dependency
- How to pass a C structure in Python
- How to change some specific fields of a structure without using for loop in matlab?
- hexo change folder structure when generate static files
- Why do websites like Classcraft not use Meteor for their Frontpage
- What is the difference between struct node* node and struct node *node?
- Centos: Merge directories while removing a common subdirectory in all subs
Related Questions in SPRITEBUILDER
- Loop an animation programatically in Cocos2d, like chaining the animation to itself in Spritebuilder
- Whats the best structure to use when you have many characters that all have the same behavior and animation but different Sprite images?
- Why is my Code Block Instance Variable not Initializing and printing out a "NSGlobalBlock"?
- Game programming in Xcode and Sprite-builder. Display while computer "thinks"
- Sharing Property information between classes in Obj C
- How can I create a pop-up window using Cocos2d, SpriteBuilder and Objective-c?
- Failed to set selector block for CCButton on a Layer
- Make an object appear in frame N and not frame 0 in SpriteBuilder
- Can't access variable declared by SpriteBuilder
- Clip CCSprite/CCNode with another CCSprite/CCNode - Cocos2D
- how to change spritebuilder Project name
- swift - CCBReader symbol not found
- cocos2d v3.x Disable device rotation, set portrait mode only
- How to use CCSlider with Xcode v6.1.1 & SpriteBuilder v1.3.6
- objective c - change fieldtext string to * like a password
Related Questions in INFRASTRUCTURE
- What is the point of definnig Asp.net Intrinsic Objects In different places and what is the different betwen them?
- Whats the best structure to use when you have many characters that all have the same behavior and animation but different Sprite images?
- AWS Cloudformation
- SOAP/REST Web Services - Infrastructure & Best Practices
- Terraform Workflow At Scale
- Cant Get the IP Address Of the client On my Published Website
- How to design and calculate cost of cloud infrastructure?
- How to setup the infrastructure with blade servers for OpenStack
- single-tenant with rapid personalization on Ruby on rails, Saas application
- How to create/use Configuration File for Infrastructure Layer (Class Library) Project in Domain-Driven Model
- Cyclic Dependency between Infrastructure and Model Layers/projects of DDD
- Declare Terraform Variable
- How to display top K nodes w.r.t CPU usage?
- How to import random_id with keepers
- How to import an existing S3 object with Pulumi?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Sorry for late the answer, but I didn't see this until now. What you are after can fairly easily be achieved in Spritebuilder, without the need of subclassing. At least, it works well if your characters are composed of a CCNode with animated sprites. Lets say you have a ccb file set up with all the animations called JungleCharacter:
Right click the JungleCharacter file and choose "Duplicate". Now, in the new file (lets say we call it SeaCharacter) you select each sprite and in the 'Item properties' pane (on the right hand side) you can change the sprite frame. So, if you'd have a sprite frame called "JungleCharacterLeftArm.png", you'd change it to the equivalent "SeaCharacterLeftArm.png".
If it's to tiresome to do this in Spritebuilder, you could opt to do it in your favorite text editor, since ccb files are xml files. You'll find them in the "Packages/SpriteBuilder Resources.sbpack" folder (right click and select "show package contents"). If you set up your image assets in a smart way like "Jungle/LeftArm.png", "Sea/LeftArm.png" you can then do a quick find and replace, replacing "Jungle" with "Sea" (you get the idea).
Hope this helps!