Hi guys
I'm not really sure how to explain this, but here goes ...
currently when setting up a monster character, I would make a container, then add a body and an eye.
self.monster1 = ...
self.monster1Body = ...
self.monster1Eye = ...
As you see I specifically preface all the body parts with - "monster1"
Is there a way, to set the bodyparts up as properties of the monster1 container?
self.monster1 = ...
self.monster1.body = ...
self.monster1.eye = ...
I'm not really sure if this is possible and I didn't explain it very well, but hopefully someone understands what I'm asking
Thank you heaps in advance!
PS. I've just tried this and it works. I can't believe I did thing the long way all this time lol.
Is this approach correct or am I going to run into problems?
Thank you again!
Comments
Likes: rolfpancake
Thank you for the reply, this really helps. I've managed to consolidate my code a lot!
The scope of my "level" doesn't get much bugger than 10 monsters with random blinks and a few event listeners