コード例 #1
0
void Game_Character::Update() {
	if (IsJumping()) {
		UpdateJump();
		if (IsSpinning())
			anime_count++;
	} else if (IsMoving()) {
		remaining_step -= 1 << (1 + GetMoveSpeed());
		if (IsSpinning() || (animation_type != RPG::EventPage::AnimType_fixed_graphic && walk_animation))
			anime_count++;
	} else {
		stop_count++;
		if (IsSpinning() || IsContinuous() || pattern != original_pattern)
			anime_count++;
	}

	if (anime_count >= GetSteppingSpeed()) {
		if (IsSpinning()) {
			SetSpriteDirection((GetSpriteDirection() + 1) % 4);
		} else if (!IsContinuous() && IsStopping()) {
			pattern = original_pattern;
			last_pattern = last_pattern == RPG::EventPage::Frame_left ? RPG::EventPage::Frame_right : RPG::EventPage::Frame_left;
		} else {
			if (last_pattern == RPG::EventPage::Frame_left) {
				if (pattern == RPG::EventPage::Frame_right) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_right;
				} else {
					pattern = RPG::EventPage::Frame_right;
				}
			} else {
				if (pattern == RPG::EventPage::Frame_left) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_left;
				} else {
					pattern = RPG::EventPage::Frame_left;
				}
			}
		}

		anime_count = 0;
	}

	if (wait_count > 0) {
		wait_count -= 1;
		return;
	}

	if (stop_count >= max_stop_count) {
		if (IsMoveRouteOverwritten()) {
			MoveTypeCustom();
		} else {
			// Only events
			UpdateSelfMovement();
		}
	}
}
コード例 #2
0
ファイル: game_character.cpp プロジェクト: Ancurio/Player
void Game_Character::Update() {
	if (IsJumping()) {
		UpdateJump();
		anime_count += (IsSpinning() ? 1.0 : 0);
	} else if (IsContinuous() || IsSpinning()) {
		UpdateMove();
		UpdateStop();
	} else {
		if (IsMoving()) {
			UpdateMove();
		} else {
			UpdateStop();
		}
	}

	if (anime_count > 36.0/(GetMoveSpeed()+1)) {
		if (IsSpinning()) {
			SetPrelockDirection((GetPrelockDirection() + 1) % 4);
		} else if (!IsContinuous() && IsStopping()) {
			pattern = original_pattern;
			last_pattern = last_pattern == RPG::EventPage::Frame_left ? RPG::EventPage::Frame_right : RPG::EventPage::Frame_left;
		} else {
			if (last_pattern == RPG::EventPage::Frame_left) {
				if (pattern == RPG::EventPage::Frame_right) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_right;
				} else {
					pattern = RPG::EventPage::Frame_right;
				}
			} else {
				if (pattern == RPG::EventPage::Frame_left) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_left;
				} else {
					pattern = RPG::EventPage::Frame_left;
				}
			}
		}

		anime_count = 0;
	}

	if (wait_count > 0) {
		wait_count -= 1;
		return;
	}

	if (stop_count >= ((GetMoveFrequency() > 7) ? 0 : pow(2.0, 9 - GetMoveFrequency()))) {
		if (IsMoveRouteOverwritten()) {
			MoveTypeCustom();
		} else if (Game_Message::GetContinueEvents() || !Game_Message::message_waiting) {
			UpdateSelfMovement();
		}
	}
}
コード例 #3
0
ファイル: game_character.cpp プロジェクト: Ancurio/Player
void Game_Character::UpdateStop() {
	if (pattern != original_pattern && !IsContinuous())
		anime_count += 1.5;

	//if (!starting || !IsLock())
		stop_count += 1;
}
コード例 #4
0
// ====================测试代码====================
void Test(char* testName, int* numbers, int length, bool expected)
{
    if(testName != NULL)
        printf("%s begins: ", testName);

    if(IsContinuous(numbers, length) == expected)
        printf("Passed.\n");
    else
        printf("Failed.\n");
}
コード例 #5
0
ファイル: game_character.cpp プロジェクト: KitoHo/Player
void Game_Character::UpdateSprite() {
	if (IsJumping()) {
		UpdateJump();
		if (IsSpinning())
			anime_count++;
	} else if (IsMoving()) {
		remaining_step -= min(1 << (1 + GetMoveSpeed()), remaining_step);
		if (IsSpinning() || (animation_type != RPG::EventPage::AnimType_fixed_graphic && walk_animation))
			anime_count++;
	} else {
		stop_count++;
		if ((walk_animation && (IsSpinning() || IsContinuous())) || pattern != original_pattern)
			anime_count++;
	}

	if (anime_count >= GetSteppingSpeed()) {
		if (IsSpinning()) {
			SetSpriteDirection((GetSpriteDirection() + 1) % 4);
		} else if (!IsContinuous() && IsStopping()) {
			pattern = original_pattern;
			last_pattern = last_pattern == RPG::EventPage::Frame_left ? RPG::EventPage::Frame_right : RPG::EventPage::Frame_left;
		} else {
			if (last_pattern == RPG::EventPage::Frame_left) {
				if (pattern == RPG::EventPage::Frame_right) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_right;
				} else {
					pattern = RPG::EventPage::Frame_right;
				}
			} else {
				if (pattern == RPG::EventPage::Frame_left) {
					pattern = RPG::EventPage::Frame_middle;
					last_pattern = RPG::EventPage::Frame_left;
				} else {
					pattern = RPG::EventPage::Frame_left;
				}
			}
		}

		anime_count = 0;
	}
}