Skip to content

Commit

Permalink
20/8/21 12:31 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
eboatwright committed Aug 20, 2021
1 parent ed09c27 commit bae9e03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtInComponentsAndSystems/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func (ir *ImageRenderer) Draw(entity *pearl.Entity, scene *pearl.Scene, screen *

parent := entity.GetParent()
if parent != nil {
parentT := parent.GetComponent("transform").(*bicas.Transform)
parentT := parent.GetComponent("transform").(*Transform)
if parentT != nil {
options.GeoM.Rotate(parentT.Rotation * math.Pi / 180)
options.GeoM.Translate(
parentT.Position.X,
parentT.Position.Y,
Expand Down
2 changes: 2 additions & 0 deletions entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (e *Entity) HasTag(tag string) bool {
// Sets Entity's parent variable
func (e *Entity) SetParent(entity *Entity) {
e.parent = entity
entity.AddChild(e)
}

// Returns Entity's parent
Expand All @@ -141,6 +142,7 @@ func (e *Entity) AddChildren(entities []*Entity) {

// Removes Entity at index from child list, but does nothing if entity specified isn't a child of entity
func (e *Entity) RemoveChildAt(index int) {
e.children[index].parent = nil
e.children = append(e.children[:index], e.children[index + 1:]...)
}

Expand Down

0 comments on commit bae9e03

Please sign in to comment.