Example #1
0
bool RunningWolf::run() {
    if (isJumping()) {
        return false;
    }
    
    runAction(m_runAction);
    return true;
}
Example #2
0
  void actionUpdate() {
    jump_power_ += jump_velocity_;

    jump_power_ <= 0.0f
      ? jump_power_ = 0.0f
      : jump_velocity_ += getGravity();

    if (!isJumping()) jump_velocity_ = 0.0f;
  }
bool StarSystem::JumpTo( Unit *un, Unit *jumppoint, const std::string &system, bool force, bool save_coordinates )
{
    if ( ( un->DockedOrDocking()&(~Unit::DOCKING_UNITS) ) != 0 )
        return false;
    if (Network == NULL || force) {
        if (un->jump.drive >= 0)
            un->jump.drive = -1;
#ifdef JUMP_DEBUG
        VSFileSystem::vs_fprintf( stderr, "jumping to %s.  ", system.c_str() );
#endif
        StarSystem *ss = star_system_table.Get( system );
        std::string ssys( system+".system" );
        if (!ss)
            ss = star_system_table.Get( ssys );
        bool justloaded = false;
        if (!ss) {
            justloaded = true;
            ss = _Universe->GenerateStarSystem( ssys.c_str(), filename.c_str(), Vector( 0, 0, 0 ) );
            //NETFIXME: Do we want to generate the system if an AI unit jumps?
        }
        if ( ss && !isJumping( pendingjump, un ) ) {
#ifdef JUMP_DEBUG
            VSFileSystem::vs_fprintf( stderr, "Pushing back to pending queue!\n" );
#endif
            bool dosightandsound = ( ( this == _Universe->getActiveStarSystem( 0 ) ) || _Universe->isPlayerStarship( un ) );
            int  ani = -1;
            if (dosightandsound)
                ani = _Universe->activeStarSystem()->DoJumpingLeaveSightAndSound( un );
	    _Universe->AccessCockpit()->OnJumpBegin(un);
            pendingjump.push_back( new unorigdest( un, jumppoint, this, ss, un->GetJumpStatus().delay, ani, justloaded,
                                                  save_coordinates ? ComputeJumpPointArrival( un->Position(), this->getFileName(),
                                                                                              system ) : QVector( 0, 0, 0 ) ) );
        } else {
#ifdef JUMP_DEBUG
            VSFileSystem::vs_fprintf( stderr, "Failed to retrieve!\n" );
#endif
            return false;
        }
        if (jumppoint)
            ActivateAnimation( jumppoint );
    } else
    //Networking mode
    if (jumppoint) {
        Network->jumpRequest( system, jumppoint->GetSerial() );
    }
    return true;
}
Example #4
0
bool RunningWolf::jump(const CCPoint & dest) {
    if (isJumping()) {
        return false;
    }
    
    m_isJumping = true;
    runAction(m_jumpAction);  
    
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    
    CCPoint pos = getPosition();
    CCPoint finalDest = destWithDest(dest, 1);
    
    CCAction * jumpHeightAction = 
    CCJumpTo::actionWithDuration(1.0f, finalDest, winSize.height * 0.1f, 1);
    runAction(jumpHeightAction);
    return true;
}
bool PlatformerEntityController::jump(float height, float time)
{
    if (isJumping() || !getEntity() || !getEntity()->hasCharacterController())
        return false;

    // Can only jump when there is a surface beneath the player
    auto collisionNormal = Vec3();
    if (!physics().getCharacterControllerDownAxisCollision(getEntity()->characterController_, collisionNormal))
        return false;

    // Can't launch off surfaces steeper than 45 degrees
    if (collisionNormal.dot(Vec3::UnitY) < 0.707f)
        return false;

    isJumping_ = true;
    jumpStartTime_ = platform().getTime();
    jumpHeight_ = height;
    jumpTime_ = time;

    return true;
}
Example #6
0
 void update() {
   actionUpdate();
   if (!isJumping() && App::get().isPushKey(JUMP)) { jump_velocity_ += JumpPower; }
 }
void LeprechaunController::dodgeRight()
{
	if (!isCaneHit() && !isStoneHit() && !isFlying() && !isJumping() && !isDodgingLeft() && !isDodgingRight() && !isCarryingPig())
		setBeginFlag(LeprechaunFlag::dodgingRight, true);
}