示例#1
0
文件: stage.go 项目: krattai/monoflow
// Rem implements move.World.Rem
func (sm *stage) Rem(body move.Body) {
	for index, b := range sm.bodies {
		if b.Id() == body.Id() {
			sm.bodies = append(sm.bodies[:index], sm.bodies[index+1:]...)
			return
		}
	}
}
示例#2
0
文件: part.go 项目: krattai/monoflow
// Part interface implementation.
func (p *part) SetBody(body move.Body, mass, bounce float64) {
	if p.body != nil {
		p.RemBody()
	}
	p.body = body.SetMaterial(mass, bounce)
	p.body.SetData(p)
	p.body.World().Loc.Set(p.loc)
	p.body.World().Rot.Set(p.dir)
	p.world.Add(p.body)
}