-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I have a pulpscript recursive call (to make some tiles slippery), like this:
on pSlip do
x = event.px
y = event.py
mSr = type x,y
if mSr=="item" then
x += event.dx
y += event.dy
ignore
wait 0.1 then
mSr = type x,y
if mSr!="item" then
mSr = name x,y
if mSr=="floor" then
mSr = "item"
end
end
listen
if mSr=="item" then
remaining++
goto x,y
call "pSlip"
end
end
end
end
After being processed with pulp-to-lula, it doesn't work correctly. The player tile moves through the slippery tiles, but its x,y coordinates are then reset to first tile.
After looking and debugging with the simulator, it looks like it can be possible that something about the wait call may cause to change player.x and player.y coordinates, between the call to smoothMovementBegin and smoothMovementEnd, when PTLE_SMOOTH_MOVEMENT_SPEED is 0.
I have found a possible solution changing the code of smoothMovementEnd from
local function smoothMovementEnd()
local player = pulp.player
player.x = pulp.smooth_true_x
player.y = pulp.smooth_true_y
pulp.PTLE_SMOOTH_OFFSET_X = 0
pulp.PTLE_SMOOTH_OFFSET_Y = 0
end
to
local function smoothMovementEnd()
local player = pulp.player
if pulp.PTLE_SMOOTH_MOVEMENT_SPEED > 0 then
player.x = pulp.smooth_true_x
player.y = pulp.smooth_true_y
end
pulp.PTLE_SMOOTH_OFFSET_X = 0
pulp.PTLE_SMOOTH_OFFSET_Y = 0
end
but i'm not totally sure that it's a good solution (i'm a newbie to lua language).
Metadata
Metadata
Assignees
Labels
No labels