Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving data with component pattern instead of inheritance. #368

Open
conqueran opened this issue Feb 26, 2022 · 0 comments
Open

Saving data with component pattern instead of inheritance. #368

conqueran opened this issue Feb 26, 2022 · 0 comments

Comments

@conqueran
Copy link

conqueran commented Feb 26, 2022

This may be a newbie question but it is unclear to me how to save data when using a component pattern. For example say I have a Room class with max 5 random monsters that all inherit from the Monster class. If I don't use inheritance how can I save the data of these monsters without knowing the info at runtime? My room might spawn 5 Tree monsters, or 2 snakes and 3 blobs or something else.. What kind of pointer do I use (I can't use Monster * monster[ 5 ] in the Room class anymore... I also asked this on stack overflow https://stackoverflow.com/questions/71280409/how-to-save-c-class-data-from-a-template-when-using-component-pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant