#GENERAL

*name = "Jump";
*desc = "It's a me, Mario.";
*stackable = 1;
*model = "item_box_01";
*color = colorRGB( 0.1, 0.1, 1.0 );
*rad        = 0.5;
*mass       = 8.0;
*elasticity = 0.1;
*drag       = 0.5;
*friction   = 3.5;
*hardness   = 0.0;
*lifetime   = 10.0;
*player_only = 1;


#ON_CREATION


#ON_DAMAGE


#ON_PICK_UP
// If the player is currently running a power-up, kill it.
var bool = avar( "player_running_powerup" );
var func = nop;
func = if( bool, char_control_pop, nop );
func( "player" );
// Kill whatever power-up sound is currently running.
sound_stop( avar("player_powerup_sid") );

// Put the character in the jumping state.
char_control_push(
  "player",
  "jumper",
  "
    *jumps    = 1;
    *vel      = 14.5;
	*particle = \"fire_05\";
  ",
  1
  );

// Play a magical jumping sound.
avar( "player_powerup_sid", sound_play( "jump/ambient_01.wav" ) );

// Record that the player is in a power-up state.
avar( "player_running_powerup", 1 );
// Make a timer to flip the power-up state flag when this power-up finishes.
timer_kill( "powerup_ender" );
timer_make( "powerup_ender", 1.1, "avar( \"player_running_powerup\", 0 );" );

// Start a timer set to go off at the same time the player lands.  The timer
// will create an explosion at the player's feet.
timer_make(
  "itm_jump_boom",
  1.6,
  "
    sound_play(\"bomb/boom_01.wav\", char_get_x(\"player\"), char_get_y(\"player\"), 1.0 );
	explosion_make(
      char_get_x(\"player\"),
      char_get_y(\"player\"),
      7,
      0.3,
      100,
      0, 1,
      \"good\"
      );
  "
  );

// This item is history.
kill_this( );

