Files
aego/modules/physics/res/docs/try/PolygonCollider2D.aes
sanspie a46347e2c6
ci-platforms / darwin arm64 smoke (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Failing after 12m19s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / windows amd64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / checks (push) Failing after 23m57s
ci / release (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: failure
GitHub / darwin arm64 native GitHub-hosted native CI: failure
GitHub / darwin amd64 native GitHub-hosted native CI: failure
GitHub / linux amd64 native GitHub-hosted native CI: success
editor: add art studio and stage 12.5 workflows
2026-11-08 18:47:57 +03:00

31 lines
1019 B
Plaintext

package demo
import (
"aego/debug"
"aego/physics"
)
// The outline follows the three actual polygon corners. The fixed-speed
// collision makes a change of restitution visible without changing the shape.
script PolygonImpact {
func Ready() {
node.Get<Body2D>().SetVelocity(Vec2{0, 15})
}
func Update(dt float) {
p := node.WorldPosition()
top := Vec2{p.X, p.Y - 0.8}
right := Vec2{p.X + 0.8, p.Y + 0.6}
left := Vec2{p.X - 0.8, p.Y + 0.6}
color := Color{1, 0.65, 0.1, 1}
// Several closely spaced strokes keep the exact outline readable in
// the small embedded Game View as well as the native editor.
for i := -2; i <= 2; i++ {
x := float(i) * 0.08
debug.Line(Vec2{top.X + x, top.Y}, Vec2{right.X + x, right.Y}, color)
debug.Line(Vec2{right.X + x, right.Y}, Vec2{left.X + x, left.Y}, color)
debug.Line(Vec2{left.X + x, left.Y}, Vec2{top.X + x, top.Y}, color)
}
}
}