コード例 #1
0
void PierrobotGear::Spawn(jvis::AnimatedSprite& player)
{
	Enemy::Spawn(player);

	_direction = (player.GetPosition().x - m_SpawnPos.x <= 0) ? Mega::Direction::LEFT : Mega::Direction::RIGHT;

	SetNumColumns(1);
	SetNumFrames(2);
	SetDelay(160);

	SetSize(jmath::vec2(32));
	SetRectangle(jmath::vec4(72, 68, 32, 32));
	GetRigidBody()->SetCollisionType(jphys::BOX_REACTIVE);
	GetRigidBody()->SetVelocity(0);
}
コード例 #2
0
ファイル: dui.c プロジェクト: seyko2/open-watcom-v2
void DUISetNumColumns( int num )
{
    SetNumColumns( num );
}
コード例 #3
0
static void ProcOptList( int pass )
{
    char        buff[80];
    char        err_buff[CMD_LEN];
    char        *curr;
    unsigned long   mem;

    SetupChar(); /* initialize scanner */
    for( ;; ) {
        SkipSpaces();
        if( !OptDelim( CurrChar ) ) break;
        NextChar();
        curr = buff;
#ifndef __GUI__
        if( CurrChar == '?' ) {
            PrintUsage( MSG_USAGE_BASE );
            StartupErr( "" );
        }
#endif
        while( isalnum( CurrChar ) ) {
            *curr++ = CurrChar;
            NextChar();
        }
        if( curr == buff ) {
            if( OptDelim( CurrChar ) ) {
                NextChar();
                SkipSpaces();
                break;
            }
            OptError( LIT( STARTUP_No_Recog_Optn ) );
        }
        switch( Lookup( OptNameTab, buff, curr - buff ) ) {
        case OPT_CONTINUE_UNEXPECTED_BREAK:
            _SwitchOn( SW_CONTINUE_UNEXPECTED_BREAK );
            break;
        case OPT_DEFERSYM:
            _SwitchOn( SW_DEFER_SYM_LOAD );
            break;
        case OPT_DOWNLOAD:
            DownLoadTask = TRUE;
            break;
        case OPT_NOEXPORTS:
            _SwitchOn( SW_NO_EXPORT_SYMS );
            break;
        case OPT_LOCALINFO:
            if( pass == 2 ) {
                char *file = GetFileName( pass );
                FindLocalDebugInfo( file );
                _Free( file );
            }
            break;
        case OPT_INVOKE:
            if( pass == 2 ) _Free( InvokeFile );
            InvokeFile = GetFileName( pass );
            break;
        case OPT_NOINVOKE:
            if( pass == 2 ) _Free( InvokeFile );
            InvokeFile = NULL;
            break;
        case OPT_NOSOURCECHECK:
            _SwitchOff( SW_CHECK_SOURCE_EXISTS );
            break;
        case OPT_NOSYMBOLS:
            _SwitchOff( SW_LOAD_SYMS );
            break;
        case OPT_NOMOUSE:
            _SwitchOff( SW_USE_MOUSE );
            break;
        case OPT_DYNAMIC:
            mem = GetMemory();
            if( pass == 1 ) {
                if( mem < MIN_MEM_SIZE ) mem = MIN_MEM_SIZE;
                MemSize = mem;
            }
            break;
        case OPT_DIP:
            {
                int i;

                for( i = 0; DipFiles[ i ] != NULL; ++i ) ;
                DipFiles[ i ] = GetFileName( pass );
            }
            break;
        case OPT_TRAP:
            if( pass == 2 ) _Free( TrpFile );
            TrpFile = GetFileName( pass );
            SkipSpaces();
            if( CurrChar == ';' ) {
                NextChar();
                GetTrapParm( pass );
            } else if( CurrChar == '{' ) {
                GetTrapParm( pass );
            }
            break;
#ifdef ENABLE_TRAP_LOGGING
        case OPT_TRAP_DEBUG_FLUSH:
            if( pass == 2 )
                _Free( TrpDebugFile );
            TrpDebugFile = GetFileName( pass );
            TrpDebugFileFlush = TRUE;
            break;
        case OPT_TRAP_DEBUG:
            if( pass == 2 )
                _Free( TrpDebugFile );
            TrpDebugFile = GetFileName( pass );
            TrpDebugFileFlush = FALSE;
            break;
#endif
        case OPT_REMOTE_FILES:
            _SwitchOn( SW_REMOTE_FILES );
            break;
        case OPT_LINES:
            SetNumLines( GetValue() );
            break;
        case OPT_COLUMNS:
            SetNumColumns( GetValue() );
            break;
#ifdef BACKWARDS
        case OPT_NO_FPU:
        case OPT_NO_ALTSYM:
            break;
        case OPT_REGISTERS:
            GetValue();
            break;
#endif
        case OPT_INITCMD:
            GetInitCmd( pass );
            break;
        case OPT_POWERBUILDER:
            _SwitchOn( SW_POWERBUILDER );
            break;
        case OPT_HELP:
#ifndef __GUI__
            PrintUsage( MSG_USAGE_BASE );
            StartupErr( "" );
#endif
            break;
        default:
            if( !ProcSysOption( buff, curr - buff, pass ) ) {
                Format( err_buff, LIT( STARTUP_Invalid_Option ), buff, curr - buff );
                StartupErr( err_buff );
            }
            break;
        }
    }
}
コード例 #4
0
// Set the relevant animation depending on the state of the player following the update loop
void Player::SetAnimationFrame()
{
	PlayerState state;
	AnimationState newState;

	if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD)
		SetDrawFlags(jvis::Sprite::DrawFlags::FlipHorizontal);
	else if (p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD)
		RemoveDrawFlags(jvis::Sprite::DrawFlags::FlipHorizontal);


	if (m_TimerDeath.ElapsedMilliseconds() > 0)
		newState = AnimationState::SPAWNING;
	// Been hit
	else if (m_TimerInvincibility.ElapsedMilliseconds() < INVINCIBILITY_TIME / 2.5f)
		newState = AnimationState::INVINCIBLE;
	else if (m_HasCollidedBelow)
	{
		if (m_TimerBulletAnimationDelay.ElapsedMilliseconds() < FIRING_ANIMATION_DELAY)
		{
			// Running and gunning
			if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD || p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD)
				newState = AnimationState::SHOOTRUN;
			else // Still firing
				newState = AnimationState::SHOOTSTILL;
		}
		else
		{
			// Running
			if (p_Window->GetKey(Mega::Keys::MOVE_LEFT) == JKEY_HOLD || p_Window->GetKey(Mega::Keys::MOVE_RIGHT) == JKEY_HOLD)
				newState = AnimationState::RUN;
			else // standing still
				newState = AnimationState::STILL;
		}
	}
	else
	{
		// Firing and jumping
		if (m_TimerBulletAnimationDelay.ElapsedMilliseconds() < FIRING_ANIMATION_DELAY)
			newState = AnimationState::SHOOTJUMP;
		else // Just jumping
			newState = AnimationState::JUMP;
	}

	if (newState != m_AnimationState)
	{
		m_AnimationState = newState;
		SetDelay(120);
		SetNumColumns(3);
		SetCurrentFrame(1);

		switch (m_AnimationState)
		{
		case INVINCIBLE:
			SetRectangle(jmath::vec4(0, 146, 32, 30));
			SetNumFrames(2);
			SetDelay(20);
			break;

		case STILL:
			SetRectangle(jmath::vec4(0, 38, 32, 30));
			SetNumFrames(1);
			break;

		case RUN:
			SetRectangle(jmath::vec4(0, 6, 32, 30));
			SetNumFrames(3);
			break;

		case JUMP:
			SetRectangle(jmath::vec4(0, 106, 32, 30));
			SetNumFrames(1);
			break;

		case SHOOTSTILL:
			SetRectangle(jmath::vec4(64, 38, 32, 30));
			SetNumFrames(1);
			break;

		case SHOOTRUN:
			SetRectangle(jmath::vec4(0, 70, 32, 30));
			SetNumFrames(3);
			break;

		case SHOOTJUMP:
			SetRectangle(jmath::vec4(32, 102, 32, 30));
			SetNumFrames(1);
			break;
		case SPAWNING:
			SetNumFrames(3);
			SetNumColumns(1);
			SetCurrentFrame(1);
			SetDelay(10000);
			break;
		}
	}
}