Yay! Another devlog and even more hours poured into this project!
This time I finally got around to reworking how the engine works to actually allow for objects to have children! In the past all objects were stored in a flat array which didn’t allow for any object parenting of any kind, but now the root of the scene is just another GameObject, so it can have children and those children can have children and so on forever.
As you can see in the example photos, the brick object on the left has a smaller checkerboard-pattern object as a child of it that moves relative to it’s parent’s rotation and position.
On the development side of things, adding objects to the scene as a whole remains exactly the same with the way the addition of objects simply being changed to having them be children of the scene root, but now all objects have a new method, GameObject.addChild(object: GameObject). This allows any object have a child added to it, for example:
player.addChild(app.createObject(
new Phoenix.Transform(new Phoenix.Vector2(0,0), 0, new Phoenix.Vector2(16, 16)),
new Phoenix.Sprite("assets/null.png"),
new Phoenix.Renderer(1)
));
This would just add a new smaller object to the player object with the null.png sprite, and this is exactly what is happening in the screenshots attached to this.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.