Questions tagged [inheritance]
In OOP, this refers to a lower-level class using the definition for a higher-level class' methods or properties.
65 questions
2
votes
2
answers
1k
views
Should a CharacterBody3D be the root of a character, or a child node?
I'm watching a tutorial on setting up a 3D player character in Godot, and at around 7:45, it shows CharacterBody3D as the root node.
I'm wondering if this is ...
1
vote
2
answers
1k
views
How should I implement the idea behind this abstract class setup in a Unity-Friendly/Inspector-Usable way?
First up, the name of the question is terrible and I am open to suggestions. For context: I'm still relatively new to C#/Unity and it's hard to ask questions properly when I don't know the terminology....
1
vote
1
answer
1k
views
How to inherit of a scene tree structure in a way that a change in the ancestor is updated in the descendant?
Consider this structure:
* KinematicBody2D (Actor)
|_ AnimationPlayer (able to make a rotation of 360)
Now I want to make a Player and an Enemy that inherits of ...
0
votes
0
answers
43
views
Overridden movement function doesn't work
I moved from C to C# so I am a novice in Object Oriented Programming. I wanted to implement OOP in my character movement, but it didn't work the way I expected.
My character is instantiated when the ...
0
votes
1
answer
582
views
How to call StartCourotine in abstract class?
Bellow is my code. I have an abstract class and a inheriting class. This keeps giving me an NullReferenceException, on the ...
0
votes
1
answer
105
views
Best way to implement a class or interface for a set of UI buttons that only differ in their Draw() function?
I have three types of UI buttons that go on a cooldown bar:
A traditional cooldown bar button where once the corresponding key is pressed, a timer shows over the button and dims the texture.
A button ...
0
votes
1
answer
1k
views
Heir Class Constructor Throws CS7036 "No Argument Given" Exception [closed]
I'm trying to create a class that holds the data for an an attack, called Attack. I also have special attacks that have more properties, and so I wanted to create a ...
0
votes
2
answers
305
views
C++ inheriting functions problem
So I am creating a game with C++ and SDL.
I have a "gameobject" header file and no cpp (I do not need it) the game object has 2 functions void render() & ...
0
votes
1
answer
87
views
why child class can access object while parent can't
I have Block class which is the parent and StandardBlock the child , the prefab block have StandardBlock script attached to it, and according to my small knowledge in inheriting I though this would ...
0
votes
1
answer
154
views
Interact with inheriting class methods from "casted" base class (collisions, etc)
I want to implement a damage system that works across both living items (Entity) and environment items (Environment). The key ...
0
votes
1
answer
1k
views
C++: Setup the basic Update function in different classes which all derive from GameObject
Im working on a little game-framework in c++. Currently i have a (base)class called "GameObject" from which all future in-game objects will derive from.
Class enemy will be ...
1
vote
1
answer
1k
views
RPG Item Design [duplicate]
I'm currently fiddling around with some RPG mechanics and I'm trying to implement a solid way to handle items that have different on use effects.
Currently, I have a base class called "Item" that ...
2
votes
1
answer
236
views
Does abstraction influence performance?
Say I have a GameObject class that is being extended by all of the objects in the game that are moving around. (This class provides basic stuff like a sprite, draw ...
0
votes
1
answer
4k
views
How to use base.Function() in Unity
I am using 3 classes:
EnemyBullet : MonoBehavior
EnemyBulletType1 : EnemyBullet
EnemyBullet Class:
...
0
votes
1
answer
402
views
Destroyed GameObject but still trying to access it(C# Unity)
EntryPoint.cs
...
0
votes
1
answer
884
views
Unitys [SerializeField] and parallel inheritance
I have the following:
...
0
votes
1
answer
241
views
How to make Scriptable Objects derive from other Gameobejcts?
I encountered a problem where I want to make a Scriptable Object that derives from another class, but C# does not support multiple inheritance. Further, I do not think it would not make sense to make ...
0
votes
3
answers
2k
views
How do I switch between different Update behaviour states in Unity?
I have a bird entity that needs different update rules when it's moving or dying (among potentially other states).
I want to avoid making my Update method a ...
3
votes
1
answer
260
views
Does interfacing not work as well when it comes to games development?
I'm currently at the start of a project, and I'm following the wisdoms of my day-to-day career as a C# developer for large web applications.
Currently I have set up a bunch of interfaces. Notable of ...
0
votes
1
answer
543
views
C# What is the advantage of using interfaces for simulating multiple inheritance? [closed]
Interfaces are a feature of C# that I've never quite been able to see the purpose of. I see them used all the time in professional code, but for the life of me I can't work out the reasoning.
My ...
1
vote
1
answer
250
views
Deriving from base class but not calling base method
I am very new to C#, XNA, and OOP. This is my question: I have an abstract class called Sprite. Sprite handles position and drawing from the sprite sheets, from its update and draw methods, for my ...
1
vote
1
answer
4k
views
Making unity inspector accept classes that inherit from a base class
I have a base class that has a lot of classes inheriting from it, I want to make a script that you can drop one of these derived classes into. How do i do that?
...
0
votes
2
answers
268
views
How do i approach these inheritance problem? (Pokemon Gen III) [closed]
I'm currently making a Pokemon clone on Python just for the heck of it. After fiddling a bit with some GBA ROM editing tools, i've found out that on these games there are, among other things:
Events ...
1
vote
1
answer
477
views
Inherited property in derived class reference only base class
[Context] I am developing a game in Unity, and wanted to make a Game Manager. Like many examples out there, it uses a Singletron design pattern. But i have several other Managers, all using Singletron ...
1
vote
0
answers
129
views
Java (libGDX) - Inheritance problems
I'm having some issues with inheritance for one of my libGDX projects, I'm making a game similar to (very stripped down) Terraria or Starbound and I am using the TiledMap to load the world, ...