Improved hack
parent
0ca1410643
commit
d6452f5ed8
|
@ -31,6 +31,19 @@ k_dash=5
|
|||
|
||||
-- HACK: used to slow down frame rate
|
||||
frame_counter = 0
|
||||
draw_frame_counter = 0
|
||||
|
||||
-- False until the game has initialized
|
||||
hack_ready = false
|
||||
|
||||
-- Skip each nth frame.
|
||||
-- Celeste usually runs at 30 fps, we run it at 60.
|
||||
-- so, a value of 2 gives normal speed
|
||||
-- and a value of 3 gives 3/2 speed.
|
||||
frame_rate_hack = 10
|
||||
|
||||
-- HACK: keep track of player state
|
||||
player_state = {}
|
||||
|
||||
-- entry point --
|
||||
-----------------
|
||||
|
@ -325,14 +338,15 @@ player =
|
|||
|
||||
|
||||
-- HACK: print player status
|
||||
printh(
|
||||
"px:" .. tostr(this.x) ..
|
||||
";py:" .. tostr(this.y)..
|
||||
";vx:" .. tostr(this.spd.x) ..
|
||||
";vy:" .. tostr(this.spd.y) ..
|
||||
";rx:" .. tostr(room.x) ..
|
||||
";ry:" .. tostr(room.y)
|
||||
)
|
||||
hack_ready = true
|
||||
player_state = {
|
||||
px = tostr(this.x),
|
||||
py = tostr(this.y),
|
||||
vx = tostr(this.spd.x),
|
||||
vy = tostr(this.spd.y),
|
||||
rx = tostr(room.x),
|
||||
ry = tostr(room.y)
|
||||
}
|
||||
|
||||
end, --<end update loop
|
||||
|
||||
|
@ -1098,11 +1112,6 @@ function kill_player(obj)
|
|||
deaths+=1
|
||||
shake=10
|
||||
|
||||
-- HACK: print death status
|
||||
printh(
|
||||
"dc:" .. tostr(deaths)
|
||||
)
|
||||
|
||||
destroy_object(obj)
|
||||
dead_particles={}
|
||||
for dir=0,7 do
|
||||
|
@ -1188,18 +1197,31 @@ end
|
|||
-- _update30 runs at 30 fps
|
||||
-- _update60 does 60 fps
|
||||
-- default for celeste is 30.
|
||||
|
||||
function _update()
|
||||
--wait(10)
|
||||
old_update()
|
||||
--[[
|
||||
if frame_counter < 10 then
|
||||
function _update60()
|
||||
if frame_counter < frame_rate_hack then
|
||||
frame_counter+=1
|
||||
else
|
||||
frame_counter = 0
|
||||
old_update()
|
||||
|
||||
if hack_ready then
|
||||
out_string = "dc:" .. tostr(deaths) .. ";"
|
||||
for k, v in pairs(player_state) do
|
||||
out_string = out_string .. k ..":" .. v .. ";"
|
||||
end
|
||||
printh(out_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called at the same rate as _update
|
||||
function _draw()
|
||||
if draw_frame_counter < frame_rate_hack then
|
||||
draw_frame_counter += 1
|
||||
else
|
||||
draw_frame_counter = 0
|
||||
old_draw()
|
||||
end
|
||||
]]--
|
||||
end
|
||||
|
||||
function old_update()
|
||||
|
@ -1270,7 +1292,7 @@ end
|
|||
|
||||
-- drawing functions --
|
||||
-----------------------
|
||||
function _draw()
|
||||
function old_draw()
|
||||
if freeze>0 then return end
|
||||
|
||||
-- reset all palette values
|
||||
|
|
Reference in New Issue