Skip to main content

Questions tagged [inheritance]

In OOP, this refers to a lower-level class using the definition for a higher-level class' methods or properties.

Filter by
Sorted by
Tagged with
0 votes
2 answers
740 views

Interactable actors should be implemented via components or inheritances?

I am new to game development and I am learning Unreal Engine right now. When a player character APlayer wants to interact with other actors (such as ...
D G's user avatar
  • 103
1 vote
2 answers
955 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....
Disgusting's user avatar
1 vote
1 answer
262 views

How to inherit from a custom node of a gdnative plugin, in gdnative?

Context I am developing a game in gdnative and I would like to design it in several "modules", where there would be: a main module for the core gameplay, a second module that I defined as a ...
florianvazelle's user avatar
1 vote
1 answer
935 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 ...
pietrodito's user avatar
0 votes
0 answers
1k views

Unity inspector not showing variables of custom component that inherits from a built-in class

I made a class AdvancedButton that inherits from the built-in class Button: ...
MisterWildcat's user avatar
0 votes
0 answers
25 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 ...
Gorlomi's user avatar
0 votes
1 answer
4k views

Can I add extra widgets to a child widget in UMG-UE4?

I have a widget base class and I would like to reuse (logic and wigdets as well) it. I created an empty widget and set the parent class to the base class I would like to inherit from in the class ...
formatc2013's user avatar
0 votes
1 answer
463 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 ...
ManoTech's user avatar
  • 147
0 votes
1 answer
4k views

Why can't this event call its parent event?

It's me... Back again... with another Unreal problem... I have an Event in my Parent Class called ...
Natalo77's user avatar
  • 699
0 votes
1 answer
66 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 ...
Thisisstackoverflow's user avatar
0 votes
1 answer
72 views

Unity & inheritance. Different results DebugMode/Build

Here are my 2 Classes ...
Sharpnel's user avatar
0 votes
1 answer
975 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 ...
Agent Tatsu's user avatar
0 votes
1 answer
145 views

Disabled script works anyway

I have a simple code that will be enabled when I kick, so I disable it right away but even though it is disabled, it works somehow. can it be because of his parent or something else I dont know of? <...
ZozeR's user avatar
  • 42
0 votes
2 answers
265 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() & ...
younlok's user avatar
  • 19
0 votes
3 answers
2k views

Inheritance - accessing child class values

I want to use the same variable for five different child classes. It is basically a boolean that is true when a player purchases an item(represented by a child class) and false when the player is yet ...
Gozmetaiemax's user avatar
0 votes
1 answer
58 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 ...
Abeer's user avatar
  • 25
1 vote
2 answers
82 views

XNA: Classes with Texture2D to be treated as one

Summarised Problem: I have an Animation class that I want to be able to treat as a Texture2D field when need be. I do not ...
sfbea's user avatar
  • 13
0 votes
1 answer
90 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 ...
Kendall's user avatar
  • 107
1 vote
1 answer
13k views

Base class undefined?

I have no idea why I'm getting this error except that it has to do with the includes. Base class header file: ...
Thomas Linssen's user avatar
0 votes
1 answer
987 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 ...
Thomas Linssen's user avatar
2 votes
1 answer
338 views

Use GKEntity's component(ofType:) with inheritance

I'm writing a SpriteKit game in swift and making use of GameplayKit's entity-component system. There are many components that do different stuff but share the same methods in which they do it, so I ...
lsauceda's user avatar
  • 151
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 ...
Grant Upson's user avatar
0 votes
1 answer
58 views

Java: Updating entities in composite design

I'm trying to move beyond inheritance based design, but I've been doing it like that for 6 years. My current hurdle is this: What's the simplest( or proper) way to update all my objects? Before, ...
user117001's user avatar
2 votes
1 answer
208 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 ...
purpule's user avatar
  • 113
2 votes
2 answers
4k views

How to expose a child node’s texture from the parent in Godot

I built a simple scene that I instanciate at will. Simply a KinematicBody2D as root, containing a Sprite and a ...
BadgerBadger's user avatar
0 votes
1 answer
4k views

How to use base.Function() in Unity

I am using 3 classes: EnemyBullet : MonoBehavior EnemyBulletType1 : EnemyBullet EnemyBullet Class: ...
Sudeep Kandregula's user avatar
2 votes
2 answers
1k views

Instantiating, Inheritance, Objects and Children basics in Unity

First off, please understand I am horrendously confused with how to do things in Unity. I might not even be asking the right questions, I'll pose my problem and hope it shows my gap in knowledge. For ...
bumble's user avatar
  • 57
0 votes
1 answer
295 views

Destroyed GameObject but still trying to access it(C# Unity)

EntryPoint.cs ...
NoobProgrammer's user avatar
3 votes
1 answer
174 views

What is the best practice for creating a system of platforms that does not use Unity's tag system?

Right now I'm finalizing my character raycast controller, but have come to the realization that Unity's tag system, which I'm using as a way for my raycasts to detect different types of platforms, is ...
Ginger and Lavender's user avatar
0 votes
1 answer
784 views

Unitys [SerializeField] and parallel inheritance

I have the following: ...
ag4w's user avatar
  • 101
0 votes
1 answer
3k views

Cannot implicitly convert type object[] to UnityEngine.GameObject[]

So, I cannot implicitly convert type object[] to UnityEngine.GameObject[]. But why? As far I know, are all types a inheritanced types of object. So, for my logic, I could put a GameObject array in a ...
Mirco's user avatar
  • 3
0 votes
1 answer
197 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 ...
reincarnationofstackexchange's user avatar
0 votes
1 answer
492 views

SFML Animation class as a strategy or an inheritance

everybody. I need to add animations to my game. And I have a question. I found AnimatedSprite class on SFML Github which is an inheritance, but in my project, I am using a lot of elements made with ...
bzfbr's user avatar
  • 3
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 ...
MrRobot9's user avatar
  • 331
6 votes
2 answers
1k views

Polymorphism vs cache-friendliness

How can we combine inheritance-based polymorphism with spatial cache friendly data structures? In a simple game engine we usually have some base Entity class which is inherited from to implement the ...
Anonymous Entity's user avatar
3 votes
1 answer
221 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 ...
James T's user avatar
  • 187
0 votes
2 answers
355 views

How to optimize classes

I am currently working on a game based on SFML and written in C++. For the HUD of the game I have a HUD class with a lot of different variables and methods. Basically most of the variables have a set ...
Martin Sand's user avatar
0 votes
1 answer
535 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 ...
Infergnome's user avatar
2 votes
1 answer
237 views

how to make weapon charge up behavior using composition

I am trying to design different weapon behaviors. Right now, there are 3 different types of weapon behaviors that i would like to implement. When not pressing anything, weapon fires at a ...
user3772547's user avatar
1 vote
1 answer
136 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 ...
Sinux1's user avatar
  • 13
1 vote
1 answer
364 views

Categorizing Projectiles in an arcade shooter (multiple inheritance?)

I have been working on a simple arcade shooter in Java in the vein of missile command/space invaders. I've made a base Projectile class and have been extending other Projectile types from it. This ...
user3772547's user avatar
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? ...
user3797758's user avatar
  • 3,641
0 votes
2 answers
2k views

What if I extend a uclass without UClass() in Unreal Engine?

What happens if I extend a uclass (or UObject) without the UClass() macro? Will it still be a UClass() and managed by the garbage collector? I'm just curious. Update I managed to extend ...
arthur.sw's user avatar
  • 291
0 votes
2 answers
249 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 ...
Dleep's user avatar
  • 101
0 votes
1 answer
3k views

Error : No default constructor exists for "Sprite" [closed]

What i want to do is make the Player class inherit the Sprite class. So I inherited it like this : class Player: public Sprite {}; But when I go to my Player....
BiiX's user avatar
  • 489
1 vote
1 answer
424 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 ...
Romulo Rocha's user avatar
0 votes
2 answers
588 views

Problem designing my pseudo-3D game with SFML

I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from Collider SpineDrawable // Sprite // AnimatedSprite D2D // D3D Both D2D and D3D inherit from <...
freesoul's user avatar
  • 393
1 vote
0 answers
108 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, ...
angusVen's user avatar
3 votes
2 answers
475 views

Space game: inheritance for spaceships?

In a space game I'm writing in C++11, I have a class Spaceship. Now I want to create 3 more spaceship types, how should I do? Attack type: have a weapon ...
Unarelith's user avatar
  • 215
4 votes
3 answers
2k views

Callback on Derived Class?

How does Unity3D implement their system where if a class is derived from MonoBehaviour and has certain methods like Awake() or Update(), they are called accordingly? I want to do a similar system for ...
JPtheK9's user avatar
  • 2,031