Skip to content

Commit 0302a42

Browse files
committed
Fix framerate-dependent red seesaw movement
Fix wind sound playing during levelscreen
1 parent 561eb19 commit 0302a42

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

game.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ function game_update(dt)
14621462
end
14631463

14641464
--WIND
1465-
if not levelfinished and windstarted then
1465+
if windstarted and (not levelfinished) then
14661466
if windsound:isStopped() then --couldn't find a wind sound!!! 11/14/2015 went to the level myself and got the sound (with a beat on it but oh well)
14671467
playsound(windsound)
14681468
end

levelscreen.lua

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function levelscreen_load(reason, i)
1515
return
1616
end
1717

18+
windsound:stop()
1819
if not continuesublevelmusic then
1920
music:disableintromusic()
2021
end

redseesaw.lua

+7-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function redseesaw:update(dt)
5959
--self.rotation = self.rotation + dt
6060
--self.rotation = math.min(math.max(self.rotation, -math.pi*.25), math.pi*.25)
6161
self.targetspeed = 0
62+
local speedmultiplier = 0.005 --due to bad math, seesaws used to be frame dependent. now it isn't, but a multiplier needs to be chosen to match how it used to act at ~200fps
6263

6364
local sr = self.size/2 --size radius
6465
local x1, x2 = self.x+math.sin(self.rotation-math.pi)*sr, self.x+math.sin(self.rotation)*sr --extents of seesaw
@@ -128,15 +129,15 @@ function redseesaw:update(dt)
128129

129130
if w.speedy >= 0 and hold then
130131
if math.ceil(w.y+w.height) >= targety then --make objects stay on tiles
131-
self.targetspeed = self.targetspeed - ( (locationn2*450*(w.weight or 1)) *dt)
132+
self.targetspeed = self.targetspeed - ( (locationn2*450*(w.weight or 1))*speedmultiplier--[[ *dt]])
132133
end
133134
--update their posistion after the seesaw moves aswell!
134135
table.insert(updatetable, {v, w, locationn})
135136
if v == "player" then
136137
w.falloverride = true
137138
w.redseesaw = 0.1
138139
end
139-
if (w.y <= targety-w.height and w.y+w.speedy*dt >= targety-w.height) then
140+
if (w.y <= targety-w.height and w.y+w.speedy*dt >= targety-w.height) and ((not v == "thwomp") and w.speedy >= 0 and w.attack) then
140141
w.speedy = math.min(0, w.speedy)
141142
end
142143
end
@@ -148,14 +149,16 @@ function redseesaw:update(dt)
148149

149150
--if self.targetspeed == 0 then
150151
if self.rotation > self.restrotation then
151-
self.targetspeed = self.targetspeed - 80*dt --40 in 60fps
152+
self.targetspeed = self.targetspeed - 80* speedmultiplier--[[*dt]] --40 in 60fps
152153
if self.rotation+self.speed*dt < self.restrotation then
153154
self.targetspeed = self.speed/2
155+
--self.speed = self.speed*0.9
154156
end
155157
elseif self.rotation < self.restrotation then
156-
self.targetspeed = self.targetspeed + 80*dt
158+
self.targetspeed = self.targetspeed + 80* speedmultiplier--[[*dt]]
157159
if self.rotation+self.speed*dt > self.restrotation then
158160
self.targetspeed = self.speed/2
161+
--self.speed = self.speed*0.9
159162
end
160163
end
161164
--else

0 commit comments

Comments
 (0)