Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Transform2D restricted to nesting only objects of the same type?

$
0
0

@nivrig wrote:

I'm curious why Transform2D is restricted to nesting only objects of the same type?

For example, the below is not possible because M.Ex.Sprite extends Transform2D<Sprite> and so can't have this Player object set as its Parent. This means I'd have to explicitly code mirroring player transform updates into any child sprites.

Or am I missing something?

public class Entity : Transform2D<Entity> {
...
}

public class Player : Entity {
    private Sprite sprite;

    public void OnEntry() {
        sprite.Parent = this;
    }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles