Compare commits

..

No commits in common. "f9f3cec9ccf2c86f84c5f1fb4b173c4debe42f6d" and "8db9182fd9290875e27f76bd8c40ced7f5850967" have entirely different histories.

2 changed files with 3 additions and 35 deletions

View File

@ -647,11 +647,6 @@ void FP_GameUpdate(TELY_Platform *platform, FP_Game *game, TELY_Renderer *render
if (TELY_Platform_InputScanCodeIsDown(input, TELY_PlatformInputScanCode_D)) if (TELY_Platform_InputScanCodeIsDown(input, TELY_PlatformInputScanCode_D))
dir_vector.x = +1.f; dir_vector.x = +1.f;
if (dir_vector.x && dir_vector.y) {
dir_vector.x *= 0.7071067811865475244f;
dir_vector.y *= 0.7071067811865475244f;
}
if (game->clicked_entity.id) { if (game->clicked_entity.id) {
if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_Delete)) if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_Delete))
FP_Game_DeleteEntity(game, game->clicked_entity); FP_Game_DeleteEntity(game, game->clicked_entity);
@ -665,8 +660,7 @@ void FP_GameUpdate(TELY_Platform *platform, FP_Game *game, TELY_Renderer *render
// NOTE: Move entity by keyboard =========================================================== // NOTE: Move entity by keyboard ===========================================================
Dqn_V2 acceleration = {}; Dqn_V2 acceleration = {};
if (game->clicked_entity == entity->handle && if (game->clicked_entity == entity->handle) {
(entity->action.state == FP_GameEntityState_Run || entity->action.state == FP_GameEntityState_Idle)) {
if (entity->flags & FP_EntityFlag_MoveByKeyboard) { if (entity->flags & FP_EntityFlag_MoveByKeyboard) {
acceleration = dir_vector * 10000000.f; acceleration = dir_vector * 10000000.f;
if (dir_vector.x) if (dir_vector.x)
@ -846,7 +840,6 @@ void FP_GameUpdate(TELY_Platform *platform, FP_Game *game, TELY_Renderer *render
{ {
bool we_are_clicked_entity = entity->handle == game->clicked_entity; bool we_are_clicked_entity = entity->handle == game->clicked_entity;
bool action_has_finished = action->timer_s != FP_GAME_ENTITY_ACTION_INFINITE_TIMER && action->timer_s >= action->end_at_s; bool action_has_finished = action->timer_s != FP_GAME_ENTITY_ACTION_INFINITE_TIMER && action->timer_s >= action->end_at_s;
bool entity_has_velocity = entity->velocity.x || entity->velocity.y;
if (action->state == FP_GameEntityState_Nil) if (action->state == FP_GameEntityState_Nil)
FP_Game_EntityActionSetState(action, FP_GameEntityState_Idle); FP_Game_EntityActionSetState(action, FP_GameEntityState_Idle);
@ -914,31 +907,7 @@ void FP_GameUpdate(TELY_Platform *platform, FP_Game *game, TELY_Renderer *render
} else if (we_are_clicked_entity) { } else if (we_are_clicked_entity) {
if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J)) { if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J)) {
FP_Game_EntityActionSetState(action, FP_GameEntityState_AttackA); FP_Game_EntityActionSetState(action, FP_GameEntityState_AttackA);
} else if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_LeftShift)) { } else if (dir_vector.x == 0.f && dir_vector.y == 0.f) {
FP_Game_EntityActionSetState(action, FP_GameEntityState_Dash);
}
}
if ((action_has_finished && !entity_has_velocity) || (we_are_clicked_entity && dir_vector.x == 0.f && dir_vector.y == 0.f)) {
FP_Game_EntityActionSetState(action, FP_GameEntityState_Idle);
}
}
if (action->state == FP_GameEntityState_Dash) {
if (action->flags & FP_GameEntityActionFlag_StateTransition) {
TELY_AssetSpriteAnimation *anim = entity->sprite_anims.data + TELY_Asset_GetSpriteAnimation(entity->sprite_anims, DQN_STRING8("Floor slide")).index;
FP_Game_EntityActionReset(action, anim->count * anim->seconds_per_frame, anim);
Dqn_V2 dash_dir = {entity->facing_left ? -1.f : 1.f, 0.f};
Dqn_V2 dash_acceleration = dash_dir * 400'000'000.f;
Dqn_f32 t = DQN_CAST(Dqn_f32)DQN_SQUARED(input->delta_s);
entity->velocity = (dash_acceleration * t) + entity->velocity * 2.0f;
} else if (action_has_finished) {
if (entity_has_velocity) {
// TODO(doyle): Not sure if this branch triggers properly.
FP_Game_EntityActionSetState(action, FP_GameEntityState_Run);
} else {
FP_Game_EntityActionSetState(action, FP_GameEntityState_Idle); FP_Game_EntityActionSetState(action, FP_GameEntityState_Idle);
} }
} }
@ -998,7 +967,7 @@ void FP_GameUpdate(TELY_Platform *platform, FP_Game *game, TELY_Renderer *render
else else
attack_dir_vector.x = -1.f; attack_dir_vector.x = -1.f;
Dqn_V2 acceleration = attack_dir_vector * 500'000.f; Dqn_V2 acceleration = attack_dir_vector * 500000.f;
Dqn_f32 t = DQN_CAST(Dqn_f32)DQN_SQUARED(input->delta_s); Dqn_f32 t = DQN_CAST(Dqn_f32)DQN_SQUARED(input->delta_s);
Dqn_f32 t_squared = DQN_SQUARED(t); Dqn_f32 t_squared = DQN_SQUARED(t);

View File

@ -50,7 +50,6 @@ enum FP_GameEntityState
FP_GameEntityState_AttackB, FP_GameEntityState_AttackB,
FP_GameEntityState_AttackC, FP_GameEntityState_AttackC,
FP_GameEntityState_Run, FP_GameEntityState_Run,
FP_GameEntityState_Dash,
}; };
struct FP_GameWaypoint struct FP_GameWaypoint