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?
131 views Asked by Daniela Carrasco At
1
There are 1 answers
Related Questions in OBJECTIVE-C
- How to control the volume of an iPhone programmatically in objective-c
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- How to set value the descriptor of iOS BLE in Objective-C?
- Unexpected #selector() Behavior in Swift-Objective-C Interop?
- In what context can we use an unqualified #selector() expression in Swift?
- AVPictureInPictureController crashes during initialization
- How to use pow() in Objective-C?
- How to change the image on the MGSwipeButton in MGSwipeTableCell
- Using sort descriptors in Outline View
- Why is my Swift function not printing from inside the dataTask closure?
- Using UICollectionViewCell with IBOutlet
- Undefined symbol: _OBJC_CLASS_$_ only on simulator
- Why can't I receive a notification sent from Camera Extension(Swift) to an observer application (obj-c++)
- Behavior of __block modifier in objc
- Inserting subview into view where I've added subviews and sublayers
Related Questions in INHERITANCE
- System.InvalidCastException while inheriting a class
- What effect does the `virtual` modifier have on an interface member?
- Is it allowed to pass "this" of derived class to constructor of base class?
- Why parent no-arg constructor is called?
- Python super().__init__() doesn't call multiple inherited classes?
- How to query child models from parent model data?
- .NET Core : disable parent application web.config inheritance
- Is it appropriate to subclass the parent's parameters in subclass __init__'s within python?
- Inheritance - is it possible to 'force' variable values relative to the derived class?
- Need more parameters in subclass overridden method
- How to call a method on a generic type from inside the generic class?
- Dependency Injection with Generic Interface and Inheritance
- Sparx Enterprise Architect - sysml - how to model a configuration on a block definition diagram using specialization
- Generic "Create" method in .NET Core that creates two entities
- crud operation and function with a an abstract class of which it had two subclasses
Related Questions in STRUCTURE
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- Python - how to make tree without any library
- Select/filter tree structure in postgres
- Matlab array of structure
- VB how to extract BRNumber, EnglishName, ChineseName from a string that is separated by space?
- Why does not it overwrite data while inputting data in for Loop (Structure)?
- PC-LINT Warning while Copying Struct into array in C
- Is there a better way to handle move validation in my chess program?
- How to relative import a package create by me using python and strucure it better?
- Why does a while loop prevent a case structure from changing states, and how can I fix it?
- In Vaadin View classes should i use Controller classes or Service classes directly
- Marshalling structure with array of structure in C# .NET 7.0
- When declaring a boost pfr char array in structure, a compile error occurs
- Structure pointer behaving weirdly
- Looping and saving or copying a 1xn structure content to Mat files
Related Questions in SPRITEBUILDER
- Load CCBi files in Cocos Creator
- ScreenShot taken with UIGraphicsGetImageFromCurrentImageContext is blank when using Cocos2D/SpriteBuilder
- Xcode will not open "Required content for Platform Android is missing"
- Installing Spritebuilder from source
- Twitter addImage returns False
- How to install and open SpriteBuilder ?
- The folder "Images.xcassets" does not exist
- How do I Install SpriteBuilder?
- Enabling debug draw on CCPhysicsNode causes crash
- SpriteBuilder Swift code connections nil reference and deallocation issues
- My label won't update and is causing my game to crash
- basic spritebuilder and swift
- Swift - Get CCNode from scene
- Handling CCSprites with Multiple Touch
- Cocos2d, swift find when Spritebuilder timeline animation completed via callback
Related Questions in INFRASTRUCTURE
- Terraform: Error: Provider configuration not present. Module gets created, but when I remove or comment it throws an error
- Inconsistencies in Server Performance Arising from Infrastructure Configuration
- How to perform sanity load test in PT environment
- Why is my Prisma connection pool failing every 8 hours?
- Is it bad to have your test and production environments on the same machine? - running container Images
- OSMnx Bike Infrastructure duplication
- AWS ECS Task fails to provision due to EMPTY CAPACITY PROVIDER
- How to share one domain between multiple servers
- Can Apache Mesos Be Used to Cluster Servers Across Departments Without Altering Application Code?
- MS Fabric and geospatial data
- Add Block to Ressource if variable is set
- Start a locally run Service and route traffic to it
- How to check VM is up and running & IP address after creating it using PowerShell commands with Type 1 Hypervisor and no GUI
- How to keep user data storage localized to a geographic region for each user?
- How to make infrastructure as code using a manifest.jps file in Jelastic platform?
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?
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)
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!