diff options
author | davidovski <david@davidovski.xyz> | 2024-04-23 18:45:25 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2024-04-23 18:45:25 +0100 |
commit | 69db833ebae7a426fb60d117c67f0b83632618d8 (patch) | |
tree | f32e32ffb4bd5b6177855c5dc9f1b5e00ed8a8fc /objects.go | |
parent | 59ac5318648ae3abe62641deec66c64e1728c973 (diff) |
add two more levels
Diffstat (limited to 'objects.go')
-rw-r--r-- | objects.go | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |