From 69db833ebae7a426fb60d117c67f0b83632618d8 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 18:45:25 +0100 Subject: add two more levels --- objects.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'objects.go') diff --git a/objects.go b/objects.go index aca9209..0dcbd67 100644 --- a/objects.go +++ b/objects.go @@ -11,7 +11,7 @@ import ( ) const ( - SPRING_FORCE = 8 + SPRING_FORCE = 7 SIDE_SPRING_FORCE = 8 ) @@ -57,7 +57,7 @@ type Player struct { func UpdateHPlatform(o * GameObject, tilemap Tilemap, others []*GameObject) bool { o.delta += 1 - if int(o.delta / 128) % 2 == 0 { + if int(o.delta / 160) % 2 == 0 { o.vx = -0.4 } else { o.vx = 0.4 @@ -69,7 +69,7 @@ func UpdateHPlatform(o * GameObject, tilemap Tilemap, others []*GameObject) bool func UpdateVPlatform(o * GameObject, tilemap Tilemap, others []*GameObject) bool { o.delta += 1 - if int(o.delta / 128) % 2 == 0 { + if int(o.delta / 160) % 2 == 0 { o.vy = -0.4 } else { o.vy = 0.4 @@ -162,7 +162,9 @@ func (o * GameObject) Update(tilemap Tilemap, others []*GameObject) { if ! o.onGround && o.vy > gravity*12 { o.PlayLand() } - o.onGround = true; + if direction == DOWN { + o.onGround = true; + } o.vx *= o.friction o.y -= o.vy @@ -378,7 +380,7 @@ func NewExit(game *Game, x, y float32) *GameObject{ exit := NewObject(game, x, y) exit.images = []*ebiten.Image{ - tilesImage.SubImage(image.Rect(0, 16, 32, 48)).(*ebiten.Image), + tilesImage.SubImage(image.Rect(0, 16, 31, 48)).(*ebiten.Image), } exit.onCollideUp = OnCollideExit exit.onCollideDown = OnCollideExit -- cgit v1.2.1