implements trait

I just port from the latest example since alex use trait to assign Entity, and change some methods in Entity.