Pause for half a second
#1
In my attempts to fix the piston-not-smoothly-extending-retracting bug, I have found that the animation is only played if the server sends the Block Action packet, waits until the animation has finished client side, and then sends the extension arm block update. It goes: Piston Base update -> Anim Packet -> pause -> Piston arm update

So... I need a way to pause the extension / retraction function in C++ for around half a second without user input or locking everything up or derpy stuff like that.

How would I do it? Tried with system("pause") in Windows and it works, but requires user interaction so it's obviously not the solution.

Edit: this works, is it good practice?
Code:
#ifdef _WIN32
#include <windows.h>
Sleep(500);
#else
#include <unistd.h>
usleep(500* 1000);
#endif
Reply
Thanks given by:


Messages In This Thread
Pause for half a second - by tigerw - 08-13-2013, 10:46 PM
RE: Pause for half a second - by xoft - 08-13-2013, 11:01 PM
RE: Pause for half a second - by tigerw - 08-14-2013, 12:18 AM
RE: Pause for half a second - by xoft - 08-14-2013, 12:55 AM
RE: Pause for half a second - by tigerw - 08-14-2013, 01:15 AM
RE: Pause for half a second - by xoft - 08-14-2013, 05:45 AM



Users browsing this thread: 1 Guest(s)