Skip to content

Instantly share code, notes, and snippets.

@marcogravbrot
Created December 28, 2016 13:08
Show Gist options
  • Save marcogravbrot/3f84a945f7f5c6342123a418ba371245 to your computer and use it in GitHub Desktop.
Save marcogravbrot/3f84a945f7f5c6342123a418ba371245 to your computer and use it in GitHub Desktop.
function main()
{
thread anti_gravity();
}
#define ANTI_GRAV_DEFAULT 800
#define ANTI_GRAV_LOW 500
function anti_gravity()
{
gravzones = GetEntArray("anti_gravity_zone", "targetname");
foreach(k, zone in gravzones)
{
zone anti_gravity_think();
}
}
function anti_gravity_think()
{
while(true)
{
self waittill("trigger", player);
player SetPlayerGravity(ANTI_GRAV_LOW);
player AllowDoubleJump(true);
while(true)
{
if(!player IsTouching(self))
{
player SetPlayerGravity(ANTI_GRAV_DEFAULT);
player AllowDoubleJump(false);
break;
}
WAIT_SERVER_FRAME;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment