Drafted backend handling of melee attack.

This commit is contained in:
genxium
2022-11-24 17:48:07 +08:00
parent fdc296531a
commit 24d5ad9dc8
9 changed files with 2197 additions and 2008 deletions

View File

@@ -20,6 +20,10 @@ func ConvexPolygonStr(body *resolv.ConvexPolygon) string {
func GenerateRectCollider(origX, origY, w, h, spaceOffsetX, spaceOffsetY float64, tag string) *resolv.Object {
cx, cy := WorldToPolygonColliderAnchorPos(origX, origY, w*0.5, h*0.5, spaceOffsetX, spaceOffsetY)
return GenerateRectColliderInCollisionSpace(cx, cy, w, h, tag)
}
func GenerateRectColliderInCollisionSpace(cx, cy, w, h float64, tag string) *resolv.Object {
collider := resolv.NewObject(cx, cy, w, h, tag)
shape := resolv.NewRectangle(0, 0, w, h)
collider.SetShape(shape)