The Dink Network

Pushing

November 17th 2013, 10:58 AM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
I have a puzzle where a lot of pushing is required. I would like it if the player could hold down an arrow key and push a rock a longer distance. The puzzle requires it to be pushed in steps however, so it shouldn't be as complex as it might sound.

What currently happens when I hold the arrow key, is that Dink starts pushing and the rock moves. This is good. However, Dink continues pushing after the rock has arrived at its position. I want Dink to start walking again, so he will continue pushing when he reaches the rock again. What would be the cleanest way to do this?
November 17th 2013, 01:38 PM
spike.gif
freeze(1)
unfreeze(1)

?
November 17th 2013, 04:07 PM
dinkdead.gif
This file worked like that, IIRC. Take a look.
November 17th 2013, 08:34 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Yes, it does indeed. Now the question is: what does this file do, that I don't do? I can't see any difference that would have any effect... Somehow it makes Dink stop pushing during the movement of the rock, but I don't see the script do anything to Dink at all. If I copy the way it handles hardness (even though I don't need it), that doesn't help either. Very strange...
November 18th 2013, 12:30 AM
knights.gif
DinkKiller
Peasant He/Him United States
The world could always use more heroes 
Oh hey. If I had known about that file it might have saved me a week of headaches getting my puzzles to work right.

November 19th 2013, 06:31 AM
spike.gif
Looks like there has to be a sufficiently long wait between freeze and unfreeze. Just as I predicted! (...)

The push animation has to have enough time to play through, or something along those lines. wait(900) is enough for me, and changing Dink's sp_frame_delay() changes the time required.
November 19th 2013, 03:07 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
Thanks Scratcher, that means using sp_seq to replace the sequence should also work, and indeed it does.

Which brings me to the next problem: is there a way to make the delay between "walking into an object" and "pushing the object" shorter?
November 19th 2013, 06:07 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
I'm afraid not. 600 ticks is what it takes. See also dink.cpp line 3036 and further:

    if (play.push_active) if (play.push_timer + 600 < thisTickCount)
    {
// stuff like setting sequence and such
        run_through_tag_list_push(h);

        return;
    }


The run_through_tag_list_push(h) triggers the "push" procedure in DinkC-land.
November 19th 2013, 08:51 PM
custom_coco.gif
Cocomonkey
Bard He/Him United States
Please Cindy, say the whole name each time. 
You COULD fake a push as soon as Dink runs into something using a touch procedure. You could make it act just like a regular push.
November 19th 2013, 09:31 PM
peasantm.gif
shevek
Peasant They/Them Netherlands
Never be afraid to ask, but don't demand an answer 
600 ticks is what it takes.

Too bad.

You COULD fake a push as soon as Dink runs into something using a touch procedure.

Yes, I thought of that, but I don't want it to be that short. I suppose I could do some delaying as well, but the puzzle is complex enough as it is. The players (yes, that's you ) will have to be patient.