summaryrefslogtreecommitdiff
path: root/objects.go
diff options
context:
space:
mode:
Diffstat (limited to 'objects.go')
-rw-r--r--objects.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/objects.go b/objects.go
index fe3028a..141bf65 100644
--- a/objects.go
+++ b/objects.go
@@ -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{}