diff options
author | davidovski <david@davidovski.xyz> | 2024-04-23 14:46:27 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2024-04-23 14:46:27 +0100 |
commit | 5fe8960b575f5b0216faafe496a2a9927fb1bb9c (patch) | |
tree | 01d3414764c02a2748cea7ea2122b78c41660767 /objects.go | |
parent | 01d37cd3369d7b17bb42fd4e26ecdd4732d75baa (diff) |
add menu
Diffstat (limited to 'objects.go')
-rw-r--r-- | objects.go | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -159,7 +159,7 @@ func (o * GameObject) Update(tilemap Tilemap, others []*GameObject) { } if o.HasCollision(tilemap, others, direction) { - if ! o.onGround && o.vy > gravity*10 { + if ! o.onGround && o.vy > gravity*1210 { o.playLand() } o.onGround = true; @@ -217,14 +217,18 @@ func (o * GameObject) HasCollision(tilemap Tilemap, others []*GameObject, dir Di return false } - func ShadowDraw(screen *ebiten.Image, image *ebiten.Image, x, y float32, alpha float32) { + ShadowDrawOffset(screen, image, x, y, alpha, shadowOffset) + } + + +func ShadowDrawOffset(screen *ebiten.Image, image *ebiten.Image, x, y, alpha, offset float32) { op := &ebiten.DrawImageOptions{} - if alpha > 0{ + if alpha > 0 { op = &ebiten.DrawImageOptions{} op.ColorScale.ScaleAlpha(alpha) op.ColorScale.Scale(0, 0, 0, 1); - op.GeoM.Translate(float64(x+shadowOffset), float64(y + shadowOffset)) + op.GeoM.Translate(float64(x+offset), float64(y + offset)) screen.DrawImage(image, op) } op = &ebiten.DrawImageOptions{} |